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

Automatic propagation of schema name as schema title #3593

Merged
merged 8 commits into from
Mar 13, 2024

Conversation

ghik
Copy link
Contributor

@ghik ghik commented Mar 12, 2024

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 in oneOf 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.

@ghik
Copy link
Contributor Author

ghik commented Mar 12, 2024

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.

@adamw
Copy link
Member

adamw commented Mar 12, 2024

@ghik let's drop that TapirSchemaToJsonSchema feature (along with the flag)

@ghik ghik marked this pull request as ready for review March 13, 2024 08:49
@adamw adamw merged commit 17af136 into softwaremill:master Mar 13, 2024
23 checks passed
@adamw
Copy link
Member

adamw commented Mar 13, 2024

Thanks :)

@ghik ghik deleted the auto-schema-titles branch March 13, 2024 12:51
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 this pull request may close these issues.

Consider adding "title" to Schema automatically
2 participants