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

Patch: Fix documentation preview with nested $ref model #46

Conversation

rovellipaolo
Copy link

@rovellipaolo rovellipaolo commented Mar 20, 2024

Fix generating a documentation preview locally, with serverless generateDocumentation command, when the template contains a reference to another local model with the $ref keyword.

For example the following template:

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

will generate (after this fix) the following documentation preview:

"components": {
  "schemas": {
    "Customer": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "address": {
          "$ref": "#/components/schemas/Address"
        },
        "addresses": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/Address"
          }
        }
      }
    }
  }
}

As you can see the $ref value is now "#/components/schemas/Address" (correct).

For more information see: #45

README.md Show resolved Hide resolved
@rovellipaolo rovellipaolo changed the title Minor: Fix documentation preview with nested model Patch: Fix documentation preview with nested $ref model Mar 21, 2024
@ottopeczWork
Copy link

@rovellipaolo - Thanks for the PR. We're looking at it.

@ottopecz
Copy link

@rovellipaolo - Left two comments.

@ottopecz ottopecz closed this Mar 22, 2024
@ottopecz ottopecz reopened this Mar 22, 2024
@ottopecz
Copy link

I left one more comment @rovellipaolo

@ottopecz
Copy link

ottopecz commented Mar 26, 2024

@rovellipaolo - Approved. Please merge it and I'll release it as a patch. (At one point I'll fix the pipeline so that the release could happen automatically)

You know what I'll merge it. I don't think you can.

@ottopecz ottopecz merged commit cf3b591 into failsafe-engineering:master Mar 26, 2024
4 checks passed
@ottopecz
Copy link

@rovellipaolo - I tried to release your patch but the pipeline failed for some reason. I'll fix it tomorrow.

@ottopecz
Copy link

@rovellipaolo - v1.3.1 is released.

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

Successfully merging this pull request may close these issues.

3 participants