Skip to content

Introduce json schema generator customisation #139

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

Closed

Conversation

bc-tayvs
Copy link

Introduce json schema generator customisation via GeneratorOptions

For #136

@jba
Copy link
Contributor

jba commented Jul 16, 2025

As described in the CONTRIBUTING doc, you should wait until we approve an issue before submitting code.
We'll look at this PR once we've agreed that #136 is the right approach.

// It allows defining custom AdditionalProperties for a specific type.
// Also, SchemaRegistry can be used to provide pre-defined schemas for specific types (e.g., struct, interfaces)
type GeneratorOptions struct {
AdditionalProperties func(reflect.Type) *Schema // input is type name
Copy link
Contributor

Choose a reason for hiding this comment

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

#185 implements the schema registry. Can you explain why AdditionalProperties is necessary also? It seems like SchemaRegistry is all that's needed.

Copy link
Author

Choose a reason for hiding this comment

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

Main issue was that interface field were not added to parent object. Because of this, MCP clients were reporting that structured response is not comply with schema. Registry should fix it.

BUT if there are another corner cases, additionalProperties should allow to resolve schema-related complains. At this point, I have implemented additionalProperties override after schema generation in our project

@bc-tayvs bc-tayvs closed this Jul 29, 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.

2 participants