-
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
Fix SmallRye Health OpenAPI definitions #42480
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
frne
force-pushed
the
smallrye-health/fix-openapi-schema
branch
from
August 12, 2024 10:11
c3c326b
to
49d087e
Compare
xstefank
approved these changes
Aug 12, 2024
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, Thanks for a very detailed PR. Great work.
This comment has been minimized.
This comment has been minimized.
I was unaware of the format validation, sorry. Fixing it anytime soon... |
frne
force-pushed
the
smallrye-health/fix-openapi-schema
branch
from
August 13, 2024 07:59
512107e
to
e0d0ae0
Compare
quarkus-bot
bot
added
area/core
area/dependencies
Pull requests that update a dependency file
area/devtools
Issues/PR related to maven, gradle, platform and cli tooling/plugins
area/documentation
area/elasticsearch
area/gradle
Gradle
area/graphql
area/grpc
gRPC
area/hibernate-orm
Hibernate ORM
area/hibernate-search
Hibernate Search
area/hibernate-reactive
Hibernate Reactive
area/infra-automation
anything related to CI, bots, etc. that are used to automated our infrastructure
area/logging
area/maven
area/mongodb
area/panache
area/persistence
OBSOLETE, DO NOT USE
area/picocli
area/platform
Issues related to definition and interaction with Quarkus Platform
area/qute
The template engine
area/reactive-messaging
labels
Aug 13, 2024
gsmet
removed
area/smallrye
area/vertx
area/scheduler
area/testing
area/reactive-messaging
area/hibernate-orm
Hibernate ORM
area/mongodb
area/platform
Issues related to definition and interaction with Quarkus Platform
area/hibernate-search
Hibernate Search
area/dependencies
Pull requests that update a dependency file
area/qute
The template engine
area/devtools
Issues/PR related to maven, gradle, platform and cli tooling/plugins
area/infra-automation
anything related to CI, bots, etc. that are used to automated our infrastructure
area/grpc
gRPC
area/hibernate-reactive
Hibernate Reactive
area/elasticsearch
area/graphql
area/rest
area/picocli
triage/flaky-test
labels
Aug 14, 2024
gsmet
approved these changes
Aug 14, 2024
Thanks for your PR! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The quarkus-smallrye-health extension exposes an openapi definition for the health endpoints it provides. The current implementation exposes a wrong schema that doesn't reflect the actual structure of the returned JSON.
Problem Statement
Since the openapi schema does not match the implementation, a JSON object is returned that does not adhere to the interface documentation. Especially in code generation use cases, this leads to errors that are difficult to debug / understand for implementers.
Current schema
The schema exposed by the current implementation renders to something similar to:
Issues with the current schema:
status
andchecks
properties (source)name
anddata
will not be used in the top-level response (source)checks
property in the top-level response schema is missing completely (source, source)checks
entries have a defined object schema ofname
,status
anddata
, that is currently not reflected in the schema (source).New schema
The schema after the fix, renders to:
This fixes the exposed schema to actually match the JSON structure returned by the endpoints. Additionally, the filter implementation (
io.quarkus.smallrye.health.deployment.HealthOpenAPIFilter
) has been refactored to use a more fluid and readable schema definition instead of the many private methods.The PR reflects a minimally functional implementation. Please provide input regarding missing features or tests.