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

feat: add discriminator example from redocly #112

Merged
merged 2 commits into from
Aug 27, 2024

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Aug 27, 2024

🧰 Changes

Redocly supports the usage of discriminator mappings that don't use anyOf or oneOf to explicitly define the objects πŸ˜΅β€πŸ’« this seems like a divergence from the OpenAPI specification (even Swagger UI doesn't support this):

In both the oneOf and anyOf use cases, all possible schemas MUST be listed explicitly.

... but this is a paradigm that users are expecting us to support (more context here). This PR adds an example of this kind of setup.

🧬 QA & Testing

Confirmed this is valid locally per rdme! And that it renders in both Redocly and ReadMe as I would expect.

For posterity, here's the new endpoint on our bin site: https://bin.readme.com/s/66ce3b9b46829b006ee0cee6

@kanadgupta kanadgupta requested a review from erunion August 27, 2024 21:40
Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmk when its merged and i'll publish

3.0/json/discriminators.json Outdated Show resolved Hide resolved
3.0/yaml/discriminators.yaml Outdated Show resolved Hide resolved
@kanadgupta kanadgupta merged commit ebb945c into main Aug 27, 2024
2 checks passed
@kanadgupta kanadgupta deleted the kanad-2024-08-27/redocly-discriminator branch August 27, 2024 22:23
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

Successfully merging this pull request may close these issues.

2 participants