Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant