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

Responses not correctly rendered with circular references #286

Open
beckyjmcd opened this issue Oct 1, 2024 · 1 comment
Open

Responses not correctly rendered with circular references #286

beckyjmcd opened this issue Oct 1, 2024 · 1 comment

Comments

@beckyjmcd
Copy link

I have a response that is rendering an array of objects defined in a schema with a circular reference. When the field corresponding to the circular reference is rendered, it's rendered as a "string" and not an "object".

Response Definition: (part of endpoint definitions)

responses:
  '200':
    description: Successful operation. Returns a Collector array containing the Collector entity version objects matching the provided NameAndTime objects. The collection contains exactly one entry for each provided NameAndTime object.
    content:
      application/json:
        schema:
          type: array
            items:
              $ref: 'collector-definition.yaml#/components/schemas/Collector'

Then if we look at the part of the schema with the circular reference (cinfiguredInputs creates the circular reference):

Collector:
  type: object
      required:
        - name
      properties:
        name:
          type: string
        effectiveAt:
          type: string
          # This date-time is instead formatted as a Unix timestamp if the header parameter time-format is TIMESTAMP for the request that results in returning this object.
          format: date-time
        canonicalName:
          type: string
        description:
          type: string
        configuredInputs:
          type: array
          items:
            $ref: '#/components/schemas/Collector'
          minItems: 1

If I render this endpoint in the plugin, it's rendering "configuredInputs" as a string instead of as an object (possibly due to the circular reference?).
Current rendered output:

[
  {
    "name": "string",
    "effectiveAt": "2024-10-01T17:30:47.500Z",
    "canonicalName": "string",
    "description": "string",
        "configuredInputs": [
          "string"
        ]
  }
]
**This is what I would expect to see rendered:**  (since confiuguredInputs is an array of Collector objects)
[
  {
    "name": "string",
    "effectiveAt": "2024-10-01T17:30:47.500Z",
    "canonicalName": "string",
    "description": "string",
        "configuredInputs": [
          {
            "name": "string"
          }
        ]
  }
]

Is there a way to get objects with circular references to render correctly?

@ak1394
Copy link
Collaborator

ak1394 commented Oct 25, 2024

I think you're referring to the Swagger UI preview? This extension uses SwaggerUI, and relevant issues should go to https://github.com/swagger-api/swagger-ui

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

2 participants