Skip to content

fix #104 duplicated inline response type schemas#105

Merged
davepacheco merged 13 commits intomainfrom
schema-dups
Apr 16, 2021
Merged

fix #104 duplicated inline response type schemas#105
davepacheco merged 13 commits intomainfrom
schema-dups

Conversation

@davepacheco
Copy link
Copy Markdown
Collaborator

Fixes #104.

@davepacheco davepacheco requested a review from ahl April 16, 2021 16:56
Copy link
Copy Markdown
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

Comment thread dropshot/src/handler.rs
fn make_subschema_for<T: JsonSchema>(
gen: &mut schemars::gen::SchemaGenerator,
) -> schemars::schema::Schema {
gen.subschema_for::<T>()
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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