question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

oneOf, anyOf not works

See original GitHub issue

Q&A (please complete the following information)

  • OS: macOS
  • Browser: [chrome, safari]
  • Method of installation: dist assets
  • Swagger-UI version: 3.18.1
  • Swagger/OpenAPI version: Swagger 2.0, OpenAPI 3.0

Content & configuration

oneOf, anyOf not works

Example Swagger/OpenAPI definition:

  /v2/teams/{id}:
    delete:
      tags:
      - Teams
      summary: Delete a team
      parameters:
      - in: path
        name: id
        required: true
        type: string
        allowEmptyValue: false
      responses:
        204:
    get:
      tags:
      - Teams
      summary: Get a team by id
      parameters:
      - in: path
        name: id
        required: true
        type: string
        allowEmptyValue: false
      responses:
        200:
          schema:
            oneOf:
              - $ref: "#/definitions/Team1"
              - $ref: "#/definitions/Team2"

Expected behavior

oneOf, anyOf works

Screenshots

image

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kalinickcommented, Aug 21, 2018

Thanks for your support, will be looking forward to the release of this feature 😃

0reactions
shockeycommented, Aug 22, 2018

Glad we could help!

Closing this out in favor of #3803.

Read more comments on GitHub >

github_iconTop Results From Across the Web

oneOf, anyOf, allOf, not - Swagger
The following JSON object is valid against both schemas, so the response body is incorrect – it should be valid against only one...
Read more >
oneOf in Swagger schema does not work - Stack Overflow
oneOf is supported in OpenAPI version 3 ( openapi: 3.0.0 ), but not in Swagger version 2 ( swagger: '2.0' ). PaymentMethod: oneOf:...
Read more >
Understanding JSON Schema 2020-12 documentation
allOf; anyOf; oneOf; not; Properties of Schema Composition. Illogical Schemas; Factoring Schemas. JSON Schema includes a few keywords for combining schemas ...
Read more >
AllOf, AnyOf, OneOf - Liquid Technologies
The 3 keywords AnyOf, AllOf and OneOf work in the same way, ... the Additional Properties not), and if both of them validated...
Read more >
Swagger UI - OneOf with discriminator didn't show schema
Hi, I'm trying this schema structure, but Swagger UI schema example don't show anything. Simple example: openapi: 3.0.2 servers: - url:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found