Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect documentation preview when template contains a $ref #45

Closed
rovellipaolo opened this issue Mar 20, 2024 · 0 comments
Closed

Incorrect documentation preview when template contains a $ref #45

rovellipaolo opened this issue Mar 20, 2024 · 0 comments

Comments

@rovellipaolo
Copy link

rovellipaolo commented Mar 20, 2024

When generating a documentation preview locally, with serverless generateDocumentation command, the documentation will not be generated correctly if the template contains a reference to another local model with the $ref keyword.

For example the following template (taken directly from the README.md file):

custom:
  documentation:
    models:
      -
        name: "Customer"
        description: "This is a customer"
        contentType: "application/json"
        schema:
          type: "object"
          properties:
            name:
              type: "string"
            address:
              $ref: "{{model: Address}}"

will generate the following documentation preview:

"components": {
  "schemas": {
    "Customer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "address": {
          "$ref": "{{model: Address}}"
        }
      }
    }
  }
}

As you can see the $ref value is "{{model: Address}}" (wrong) rather than "#/components/schemas/Address" (correct).

NOTE: The documentation preview will be generated correctly if the reference is to a URL (e.g., "http://path/to/your/resource").

Although it's expected that the documentation preview might potentially be invalid or anyway different from the final documentation (which is why it's called "preview"), it would be nice to fix this use-case.

rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 20, 2024
rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 21, 2024
rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 25, 2024
rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 25, 2024
rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 25, 2024
rovellipaolo added a commit to rovellipaolo/serverless-aws-apigateway-documentation that referenced this issue Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant