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

fix #104 duplicated inline response type schemas #105

Merged
merged 13 commits into from
Apr 16, 2021
Merged

Conversation

davepacheco
Copy link
Collaborator

Fixes #104.

@davepacheco davepacheco requested a review from ahl April 16, 2021 16:56
Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship it

fn make_subschema_for<T: JsonSchema>(
gen: &mut schemars::gen::SchemaGenerator,
) -> schemars::schema::Schema {
gen.subschema_for::<T>()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice find; I hadn't seen that method previously

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, I only found it when digging into why non-top-level types did create references instead of inline schemas.

Copy link
Collaborator

@ahl ahl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ship it

@davepacheco
Copy link
Collaborator Author

There were a bunch of changes after @ahl's review, but they were mostly churn. The net change from 9ffb17d to 5873dbb (the current tip of this branch) is (1) I applied the change to TypedBody and (2) I added test cases for duplicated types in query parameters, request bodies, and a mix of places.

@davepacheco davepacheco merged commit 8d2fd34 into main Apr 16, 2021
@davepacheco davepacheco deleted the schema-dups branch April 16, 2021 20:59
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.

top-level types are always inline, so duplicated in the schema
2 participants