We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
If there is 2 or more types with same name, they will override each other, when schema generated. For example
handler1.rs
#[derive(JsonSchema)] struct Request { name: String }
handler2.rs
#[derive(JsonSchema)] struct Request { id: u64 }
will create only one definition in #/components/schema, and handlers from both files wil reference same schema.
#/components/schema
First potenial fix - enable inlining in https://docs.rs/schemars/latest/schemars/gen/struct.SchemaSettings.html#structfield.inline_subschemas, which will solve most problems (probably everything sxcept recursive types).
The text was updated successfully, but these errors were encountered:
Proper solution could be adding some attribute to schemars macro JsonSchema, which will make type non-referenceable, like
schemars
JsonSchema
#[derive(JsonSchema)] #[schemars(referenceable = false)] struct Request { ... }
Sorry, something went wrong.
No branches or pull requests
If there is 2 or more types with same name, they will override each other, when schema generated. For example
handler1.rs
handler2.rs
will create only one definition in
#/components/schema
, and handlers from both files wil reference same schema.First potenial fix - enable inlining in https://docs.rs/schemars/latest/schemars/gen/struct.SchemaSettings.html#structfield.inline_subschemas, which will solve most problems (probably everything sxcept recursive types).
The text was updated successfully, but these errors were encountered: