Skip to content

Conversation

@jokemanfire
Copy link
Collaborator

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Ignores fields that are not defined in the spec file.

Signed-off-by: jokemanfire <[email protected]>
Copy link
Contributor

Copilot AI left a 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();
Copy link

Copilot AI May 16, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

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.

Copy link
Contributor

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

@4t145
Copy link
Collaborator

4t145 commented May 16, 2025

Feel free to merge it!

@jokemanfire jokemanfire merged commit 01eedb7 into modelcontextprotocol:main May 16, 2025
9 checks passed
@Hendler
Copy link
Contributor

Hendler commented May 16, 2025

@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.

@github-actions github-actions bot mentioned this pull request Jul 2, 2025
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.

3 participants