-
Notifications
You must be signed in to change notification settings - Fork 422
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
Automatic propagation of schema name as schema title #3593
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
ghik
commented
Mar 12, 2024
docs/openapi-docs/src/test/resources/coproduct/expected_coproduct_independent.yml
Show resolved
Hide resolved
I'm analyzing test failures and it seems that there's a conflict - TapirSchemaToJsonSchema also propagates schema names as titles, and it does it in a way that is incompatible with what I've added (i.e. it uses final, deduplicated schema names as titles). Not sure what to do about it. |
@ghik let's drop that |
ghik
commented
Mar 13, 2024
...apispec-docs/src/test/scala/sttp/tapir/docs/apispec/schema/TapirSchemaToJsonSchemaTest.scala
Show resolved
Hide resolved
Thanks :) |
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.
Closes #3447
At first, I tried a solution that would be as conservative as possible, i.e. adding a schema
title
only to coproduct case schemas. Ultimately, this doesn't seem practical because schemas listed inoneOf
must be references (at least when discriminator field is used). This would require creating an additional, artificial named schema for every case, with only the title added, and it would probably look ugly in Swagger.We should probably also be a bit careful with adding titles to all schemas unconditionally, as it may have some unintended side effects in Swagger (which I'm not aware of, so maybe I'm just being paranoic).
There's also always an option of making this behavior configurable with a flag.