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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for OAS 3.0 oneOf discriminators #741

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

simba909
Copy link

@simba909 simba909 commented Apr 9, 2024

Problem

When adding an OpenAPI Discriminator Object to my response schema, rswag doesn't use it to disambiguate between similar schemas specified inside of a oneOf. This makes it impossible to express multiple schemas that are potentially ambiguous to the validator.

Solution

Implement support for using a Discriminator Object (if available) to disambiguate between schemas to use for response validation.

Important: I'm not a Ruby developer by trade which means that this code likely can be improved by someone who knows what they're doing 馃槄 Any and all suggestions are welcome! I'd love to learn more about this. I've opted not to update the changelog or add documentation yet since I'd like to get feedback on the implementation first.

This concerns this parts of the OpenAPI Specification:

The changes I made are compatible with:

  • OAS2
  • OAS3
  • OAS3.1

Related Issues

Links to any related issues.

Checklist

  • Added tests
  • Changelog updated
  • Added documentation to README.md
  • Added example of using the enhancement into test-app

Steps to Test or Reproduce

I've added test cases to validate that the library now uses the discriminator object.

@simba909
Copy link
Author

simba909 commented Jun 8, 2024

@romanblanco Unsure if you're the right person to request review from but maybe you can point me in the right direction 馃檪

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.

None yet

1 participant