javalin / javalin-openapi

Annotation processor for compile-time OpenAPI & JsonSchema, with out-of-the-box support for Javalin 5.x, Swagger & ReDoc
https://github.com/javalin/javalin-openapi/wiki
Apache License 2.0
45 stars 17 forks source link

@Schema annotation not taken into account for data description #188

Closed ysavourel closed 1 year ago

ysavourel commented 1 year ago

Hi, I am trying to migrate to the new OpenAPI plugin (5.5.0-1) and I cannot manage to get the @Schema annotations (of io.swagger.v3.oas.annotations.media) to be taken into account by the plugin. I have noticed the @OpenApiDescription and @OpenApiRequired (of io.javalin.openapi) and those seem to be processed properly. But they are not enough to describe the properties of the DTOs. For example defaultValue, nullable, maxLength, etc. that exist for @Schema are not available.

I do have the openapi-annotation-processor set in my POM and it seems to work properly. Do I need another processor for the @Schema annotations? In short: How can I re-use @Schema or use other annotations with the latest version of the OpenApi plugin for Javalin to generate a properly documented schema in the Swagger page?

Thanks -yves

dzikoysk commented 1 year ago

Hi, @Schema from Swagger is not supported. There's a full response in similar issue with a reference to the solution:

ysavourel commented 1 year ago

Thanks for the pointer. A mix of @Custom and defining a few @CustomAnnotation seems to resolve the problem.