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 for request bodies does not respect definition order of properties #507

Closed
cmeeren opened this issue May 26, 2018 · 7 comments
Closed

Comments

@cmeeren
Copy link

cmeeren commented May 26, 2018

Consider the following definition:

requestBody:
  content:
    application/json:
      schema:
        allOf:
          - properties:
              username:
                description: The user's username (case insensitive)
                type: string
          - oneOf:
              - properties:
                  password:
                    description: The user's password
                    type: string
              - properties:
                  mobile:
                    description: The user's mobile
                    type: string

This results in the following renderings:

image

image

I would expect password and mobile to be at the bottom, i.e. in the order they appear in the source code.

Switching the order of the two array items under allOf does not alter the output.

@cmeeren cmeeren changed the title allOf for request bodies does not respect definition order allOf for request bodies does not respect definition order of properties May 26, 2018
@viralanomaly
Copy link
Contributor

I'm having this problem, too. I have a nightmarism API I'm documenting with multiple nested allOf calls, and it comes out looking awful because of this.

@viralanomaly
Copy link
Contributor

If @RomanGotsiy or somebody else can point me in the right direction, I could try to figure this out. No promises or anything, but it might be worth the effort.

@trip-somers
Copy link

I noticed this, too. It seems to be related specifically to allOf. A few selections from my discriminator contain the fields in the expected order, but two very specific ones are in a different order, and for the life of me, I can not figure out why those two get re-ordered.

@trip-somers
Copy link

trip-somers commented Jul 18, 2018

I know this was just closed, but I want to add that my issue was related to a field being defined in two of the allOf schemas. When I corrected this, the field order was predictable and as-defined.

@RomanHotsiy
Copy link
Member

Can it be reproduced on the latest redoc@2.0.0-alpha.29?

@trip-somers
Copy link

I was just trying to add information for anyone that may write technically invalid OAS 3 specs. I can try to test the double-definition thing later, but I'll probably forget to do it. :-\

Either way, I think my particular issue was Bad Specs rather than a ReDoc bug.

@RomanHotsiy
Copy link
Member

Got it! thanks for the update

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

4 participants