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

oneOf cases referencing external files are empty and recursive from the third case #723

Closed
cmeeren opened this issue Nov 21, 2018 · 2 comments

Comments

@cmeeren
Copy link

cmeeren commented Nov 21, 2018

I have the following response:

application/json:
  schema:
    oneOf:
      - $ref: 'errors.yaml#/SignInNoValidMobile'
      - $ref: 'errors.yaml#/SmsSendingFailed'
      - $ref: 'errors.yaml#/SignInInvalidCredentials'

In errors.yaml I have defined the three types. They are, for all intents and purposes, identical. (I have even tried copying them from one another and only edited the name.)

It seems that all oneOf cases from the third element are rendered as empty and recursive:

image

The first two work fine, but no matter which order I put them in, the third one is rendered as shown above. The same goes for a fourth element that I tried adding.

@RomanHotsiy
Copy link
Member

Could you setup a minimal reproducible sample for this?
Thanks

@cmeeren
Copy link
Author

cmeeren commented Nov 21, 2018

It seems an allOf was also needed.

Main file:

openapi: 3.0.0
info:
  version: 1.0.0
  title: Test

paths:

  /endpoint:
    get:
      responses:
        '200':
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: 'types.yaml#/Type1'
                  - $ref: 'types.yaml#/Type2'
                  - $ref: 'types.yaml#/Type3'
                  - $ref: 'types.yaml#/Type4'
                  - $ref: 'types.yaml#/Type5'

types.yaml:

BaseType:
  properties:
    base:
      type: string

Type1:
  allOf:
    - $ref: '#/BaseType'
    - properties:
        foo:
          type: string

Type2:
  allOf:
    - $ref: '#/BaseType'
    - properties:
        bar:
          type: string

Type3:
  allOf:
    - $ref: '#/BaseType'
    - properties:
        baz:
          type: string

Type4:
  allOf:
    - $ref: '#/BaseType'
    - properties:
        qux:
          type: string

Type5:
  allOf:
    - $ref: '#/BaseType'
    - properties:
        har:
          type: string

Behavior:

bug

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