-
Notifications
You must be signed in to change notification settings - Fork 400
fix(schemar): Use custom settings without packaging settings #180
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
Conversation
Ignores fields that are not defined in the spec file. Signed-off-by: jokemanfire <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the schemar configuration to allow custom settings without enforcing packaging settings, providing more flexibility in handling fields not defined in the spec file.
- Replaces the use of schemars::r#gen::SchemaSettings::openapi3() with customized default settings
- Explicitly sets several configuration options (e.g., option_nullable, definitions_path, meta_schema) for schema generation
| /// A shortcut for generating a JSON schema for a type. | ||
| pub fn schema_for_type<T: JsonSchema>() -> JsonObject { | ||
| let settings = schemars::r#gen::SchemaSettings::openapi3(); | ||
| let mut settings = schemars::r#gen::SchemaSettings::default(); |
Copilot
AI
May 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment here explaining why the custom settings are used instead of openapi3(), detailing the specific needs addressed by these settings to aid future maintainers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's no need to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a better solution. Nice work
|
Feel free to merge it! |
|
@jokemanfire definitely a good change. Could the configurations have worked with OpenAPIv3? I think there will be other issues that arise because we won't have the latest. |
The Shemar configuration of the packaging lacks flexibility and ignores fields that are not defined in the spec file.
Motivation and Context
How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Additional context