dredd icon indicating copy to clipboard operation
dredd copied to clipboard

oneOf doesn't work as expected

Open doraeric opened this issue 4 years ago • 0 comments

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

doraeric avatar Oct 11 '21 18:10 doraeric