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

allOf not displayed correctly when part of an array type #349

Closed
philip-ellis-sp opened this issue Nov 18, 2022 · 3 comments
Closed

allOf not displayed correctly when part of an array type #349

philip-ellis-sp opened this issue Nov 18, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@philip-ellis-sp
Copy link

Describe the bug

If I have a spec defined with an array with items that are allOf under it, the generated documentation does not show the response correctly

Expected behavior

The response should show all of the objects defined in the schema.

Current behavior

Currently, the only thing that is displayed is the text "allOf" Example below:

image

Possible solution

Unsure at this time.

Steps to reproduce

Live example can be found here: https://developer.sailpoint.com/idn/api/v3/list-identity-profiles/

to reproduce this bug, you can create a schema with a response that has an array type with allOf in the items. An example response yaml:

  responses:
    '200':
      description: List of identityProfiles.
      content:
        application/json:
          schema:
            type: array
            items:
              allOf:
              - type: object
                properties:
                  id:
                    description: System-generated unique ID of the Object
                    type: string
                    example: id12345
                    readOnly: true
              - type: object
                properties:
                  description:
                    type: string
                    description: The description of the Identity Profile.
                    example: My custom flat file profile
                    nullable: true

Then generate the documentation and not that the all of is not presented properly.

Context

Our specification has a few instances of this scenario and they are not rendered properly on the page. I tried limiting the schema to just two objects and the error still persisted. I also switched it from allOf to oneOf and the oneOf was presented just fine, so it appears to be limited to just the allOf type.

Your Environment

  • Version used:
    "docusaurus-plugin-openapi-docs": "^1.4.5",
    "@docusaurus/core": "^2.2.0",
@sserrata
Copy link
Member

sserrata commented Dec 2, 2022

Available for testing in 0.0.0-522. Thanks!

@sserrata sserrata closed this as completed Dec 2, 2022
@maciekpitucha
Copy link

maciekpitucha commented Dec 6, 2022

I'd be also interested in that. I tested the 0.0.0-522 but it seems to display just one (the second) of the two properties from the @philip-ellis-sp's example:

image

I think both should be displayed.

@sserrata would you mind taking a look?

@maciekpitucha
Copy link

maciekpitucha commented Dec 27, 2022

  1. @sserrata I've looked into this and the unexpected behaviour from my previous post appears only if readOnly: true is used, like in @philip-ellis-sp's example. Without it, it works as expected in 0.0.0-522.
  2. However, if the array with allOf is a property of the top level object, the schema is not displayed.
type: object
properties:
  top_level_property:
    type: array
    items:
      allOf:
        - type: object
          properties:
            id:
              description: System-generated unique ID of the Object
              type: string
              example: id12345
              # readOnly: true
        - type: object
          properties:
            description:
              type: string
              description: The description of the Identity Profile.
              example: My custom flat file profile
              nullable: true

produces the following output:

image

would you rather I report it in a new issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants