eclipse / microprofile-open-api

Microprofile open api
Apache License 2.0
131 stars 81 forks source link

With @Schema annotated Classes (and Enums) are always added to generated open api definition #500

Open HelvetiaAppDev opened 2 years ago

HelvetiaAppDev commented 2 years ago

All Classes and Enums that are annotated with the @Schema annotation are automatically added to the generated open api definition. This is not always intended, as those types should only be added if they are used as input or output (direct and indirect) in any of the exposed endpoints.

We have a library with pojos and some pojos have the @Schema annotation, mostly to add a description. Another project uses some pojos from that library but also has its own pojos. When we generate the openapi.yml for that project, all pojos with the schema annotation are included in the openapi.yml, even if they are not (transitively) included in any pojo that we expose over the REST API.

Is this intended behavior? Is there a way to debug or find out, why those pojos are included?

MikeEdgar commented 2 years ago

@HelvetiaAppDev, have you tried using the mp.openapi.scan.exclude.packages or mp.openapi.scan.exclude.classes property to ignore the POJOs you would like to keep out of the API definition?