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

Please add an annotation @Xml to be added to @Schema to add xml attributes to schemas #530

Open
JeroenHeemskerk opened this issue Apr 28, 2022 · 3 comments

Comments

@JeroenHeemskerk
Copy link

When you define a Schema object you can supply an Xml object. But when you use the @Schema annotation there is no possibity to add an @Xml annotation.

I would like to do for example

@Schema(name="MyBookings", description="POJO that represents a set of bookings.", 
        xml = @Xml(name="Bookings", wrapped=true))
public class Bookings {
   @Schema(required=true)
   private Booking[] bookings;
}
@Schema(name="MyBooking", description="POJO that represents a booking.", 
        xml = @Xml(name="Booking"))
public class Booking {
    @Schema(required = true, example = "32126319")
    private String airMiles;

    @Schema(required = true, example = "window")
    private String seatPreference;
}

The only workaround to force an xml element in the schema is to make an overrride of filterSchema in an OASFilter

@MikeEdgar
Copy link
Member

@JeroenHeemskerk have you tried using the JAXB annotations for this? I.e. @XmlElement, @XmlType, etc.

@JeroenHeemskerk
Copy link
Author

No i have not tried that, because it was not mentioned in the documentation that this would generate an XML section in the schema.

I am currently no longer able to test it out, but maybe someone else would.

@MikeEdgar
Copy link
Member

We discussed this request in the 2023-01-30 group call and decided it would be a good addition to the next minor (3.2, if we do it) or major (4.0) release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants