-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OpenAPI enhancement #25800
OpenAPI enhancement #25800
Conversation
…tion by other extensions Signed-off-by: Phillip Kruger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should explicitly have serverHost
and serverPort
here defaulting to ${quarkus.http.host}
and ${quarkus.http.port}
.
The reason is because the host and port are runtime configs (meaning that the built binary will have the host and port set during the build) and also because an application running in OpenShift won't set these parameters, so it will expose localhost
and 8080
through a route (eg.https://registry.quarkus.io)
Since the config expects an URL maybe have an |
You mean have new configs that does this ? |
Yes, sorry for not being clear |
The auto server feature happens at build time, so if the values are changes in runtime, the user will have to set this the non auto way, for now |
Yeah, that would have to be a build time config. I personally think that using |
I can open another issue that allows config values in the schema, that we replace in runtime, but that is a separate issue. For now then I'll create new configs that default to quarkus.http.host and quarkus.http.port. Right ? |
@gastaldi actually thinking about it some more, it does not make sense to introduce those two new config options. The whole point of auto server is to add the server entry in the schema if the user did not. The user can already add the server in the schema with config or annotations. So if they are going to go through the trouble to add config, the auto filter is not needed anymore. Make sense ? |
@phillip-kruger right, that makes sense to me.
UPDATE: Just saw it does in the Javadoc: |
Mmm, let me check that out tomorrow |
/cc @MikeEdgar |
b4854bc
to
34a7a6a
Compare
Ok @gastaldi . During runtime servers can be added to the scheme using the spec's defined I have changed this feature to not be always enabled, because when using swagger-ui, these can be some CORS issues between 0.0.0.0 and localhost. So this is really in the case where you want to export the openapi schema document to use with code generation etc. So now this will be added in the export case by default, but need to explicitly set to add to runtime. Hope this makes sense. |
34a7a6a
to
a201bfa
Compare
...yment/src/main/java/io/quarkus/smallrye/openapi/common/deployment/SmallRyeOpenApiConfig.java
Outdated
Show resolved
Hide resolved
...deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/filter/AutoServerFilter.java
Outdated
Show resolved
Hide resolved
a201bfa
to
242c765
Compare
This comment has been minimized.
This comment has been minimized.
242c765
to
7ac4bd0
Compare
Signed-off-by: Phillip Kruger <[email protected]>
7ac4bd0
to
951e183
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I added the breaking change label due to the fact that if you are using your own filter (for OpenAPI) and that filter can not run during build time, then you app will now break. This is due to the fact that we are now having a BuildItem that contains the generated OpenAPI document. So Filters needs to handle the case of creating the OpenAPI document during build. |
Hi @phillip-kruger , |
They will be in 2.10 in a week or so |
Small PR that adds the following to the OpenAPI Extension:
quarkus.http.host
andquarkus.http.port
.I am working on an extension (still early days) that will generate JS from the Schema, and these features originates from there.