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

Missing oneOf sections for polymorphic schema #4330

Open
wtrocki opened this issue Dec 19, 2022 · 2 comments
Open

Missing oneOf sections for polymorphic schema #4330

wtrocki opened this issue Dec 19, 2022 · 2 comments

Comments

@wtrocki
Copy link

wtrocki commented Dec 19, 2022

Using swagger core with java structures that have multiple polymorphism use cases.

Current state

Swagger core always require to specify oneOf when discriminator mapping is present

@Schema(
    discriminatorProperty = "type",
    discriminatorMapping = {
         {
            @DiscriminatorMapping(
                value = "Test",
                schema = MyClass1.class)
          },
    }
    oneOf = {
      MyClass1.class
    })

Expected behaviour

Swagger core discovers and provides oneOf values for schemas (especially when discriminator mapping is present)

@Schema(
    discriminatorProperty = "type",
    discriminatorMapping = {
         {
            @DiscriminatorMapping(
                value = "Test",
                schema = MyClass1.class)
          },
    })
@wtrocki
Copy link
Author

wtrocki commented Dec 19, 2022

OpenAPI Spec explaining discriminator and oneOf requirement: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md#discriminator-object

@jochenberger
Copy link

See also #3411

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

No branches or pull requests

2 participants