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

smallrye-open-api does not read user properties correctly/consistently #2046

Closed
dhoffer opened this issue Oct 29, 2024 · 2 comments · Fixed by #2048
Closed

smallrye-open-api does not read user properties correctly/consistently #2046

dhoffer opened this issue Oct 29, 2024 · 2 comments · Fixed by #2048

Comments

@dhoffer
Copy link

dhoffer commented Oct 29, 2024

We have several REST services hidden as they are not user facing REST endpoints. We have been adding them to our application.yml file but certain properties can't be read from that file. The ones that can be read this way include mp.openapi.extensions.smallrye.XXX. The ones that can't be read this way include mp.openapi.scan.exclude.XXX.

We found that the only way to read the latter ones is to include them in the microprofile-config.properties file. This is undesirable for two reasons. Properties can't be specified in just one file, and microprofile-config.properties requires them in CSV list which is very hard to read.

Also what we would really like is an class level annotation to do the same. Originally I thought @Schema(hidden = true) would work but it doesn't work at the class level.

Upon further investigation it appears the problem is that it can't read the properties that are Lists in YAML files. If we put the CSV string in the YAML file then it can read it. But it should be able to read lists in YAML format in YAML files.

@MikeEdgar
Copy link
Member

To summarize, the issue is that mp.openapi.scan.exclude is not being read when the value is a list - but it is being read properly when it is a string?

@dhoffer
Copy link
Author

dhoffer commented Oct 29, 2024

Yes both mp.openapi.scan.exclude.classes & mp.openapi.scan.exclude.packages do not work in YAML format when specified as a list, but if specified as CSV string then it works.

However IMHO mp.openapi.scan.exclude.classes should have a class level annotation that hides the class so this property would not be required. E.g. @Schema(hidden = true) @operations(hidden = true) can be hidden so why not the class as well? Note we can't just add @operations(hidden = true) to all methods because when the class is hidden it includes inherited methods (but only when the class is hidden).

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

Successfully merging a pull request may close this issue.

2 participants