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

$ref not evaluated in examples #37

Open
v-dogg opened this issue Nov 16, 2023 · 0 comments
Open

$ref not evaluated in examples #37

v-dogg opened this issue Nov 16, 2023 · 0 comments

Comments

@v-dogg
Copy link

v-dogg commented Nov 16, 2023

Schema:

"components": {
  "examples": {
    "customerData": {
      "value" : {
        "id": "customer-id-test",
        "createdAt": 1234567890,
        "name": "Customer name"
      }
    }
  },
...
"/v1/customers": {
  "get": {
    "tags": ["Customers"],
    "parameters": [],
    "responses": {
      "200": {
        "description": "Success response.",
        "content": {
          "application/json": {
            "schema": {
              "allOf": [
                ...
                {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/customer"
                      }
                    }
                  },
                  "example": {
                    "$ref": "#/components/examples/customerData/value"
                  }
                }
              ]
....

Generated mock response:

export function getGetV1Customers200Response() {
  return { $ref: "#/components/examples/customerData/value" };
}

Expected:

Referenced value expanded. Swagger preview as an example.

image
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