Skip to content

@Schema oneOf config is ignored when generate the api-docs #2705

Closed
@abccbaandy

Description

@abccbaandy
  • What version of spring-boot you are using?
    3.3.3

  • What modules and versions of springdoc-openapi are you using?
    2.6.0

  • What is the actual and the expected result using OpenAPI Description (yml or json)?

                    "MyPojo": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Child1"
                            },
                            {
                                "$ref": "#/components/schemas/Child2"
                            },
                            {
                                "$ref": "#/components/schemas/Child3"
                            }
                        ]
                    },

should be

                    "MyPojo": {
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/Child1"
                            },
                            {
                                "$ref": "#/components/schemas/Child2"
                            }
                        ]
                    },
  • Provide with a sample code (HelloController) or Test that reproduces the problem
    @Schema(oneOf = {Child1.class, Child2.class})
    private Parent obj;

Also, according to this issue
#2704
I think this issue relate to Springdoc now, instead swagger core, because even I use my own converter to "fix" it, it will overwrite by Springdoc's converter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    incompleteincomplete description: Make sure you Provide a Minimal, Reproducible Example - with HelloController

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions