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 doesn't work as expected #1968

Open
doraeric opened this issue Oct 11, 2021 · 0 comments
Open

oneOf doesn't work as expected #1968

doraeric opened this issue Oct 11, 2021 · 0 comments

Comments

@doraeric
Copy link

doraeric commented Oct 11, 2021

Describe the bug
Using oneOf in response content schema doesn't take effect, looks like it only choose the first in oneOf

To Reproduce

  1. save the code to example.yml
openapi: "3.0.3"
info:
  title: Test API
  version: "1"
servers:
  - url: https://ipinfo.io
paths:
  /8.8.8.8/json:
    get:
      description: IP
      responses:
        "200":
          description: OK
          content:
            application/json; charset=utf-8:
              schema:
                oneOf:
                  - type: object
                    properties:
                      error:
                        type: string
                  - type: object
                    properties:
                      ip:
                        type: string
                      hostname:
                        type: string
                      anycast:
                        type: boolean
                      city:
                        type: string
                      region:
                        type: string
                      country:
                        type: string
                      loc:
                        type: string
                      org:
                        type: string
                      postal:
                        type: string
                      timezone:
                        type: string
                      readme:
                        type: string
                  
  1. run dredd ./example.yml https://ipinfo.io

Expected behavior
pass without error

What is in your dredd.yml?

skip...

What's your dredd --version output?

dredd v14.0.0 (Linux 5.13.19-2-MANJARO; x64)

Note: if you switch the order, it will pass testing

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