Repository navigation
Add logic to handle any type (3.1) with additional properties #24559
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2182,13 +2182,22 @@ protected Schema processNormalize31Spec(Schema schema, Set<Schema> visitedSchema | |
| normalizeExclusiveMinMax31(schema); | ||
|
|
||
| if (schema instanceof JsonSchema && | ||
| schema.get$schema() == null && | ||
| schema.getTypes() == null && schema.getType() == null) { | ||
| schema.get$schema() == null && schema.getTypes() == null && schema.getType() == null) { | ||
| // convert any type in v3.1 to empty schema (any type in v3.0 spec), any type example: | ||
| // components: | ||
| // schemas: | ||
| // any_type: {} | ||
| return new Schema(); | ||
| Schema sc = new Schema<>(); | ||
|
|
||
| // copy description, title, etc | ||
| ModelUtils.copyMetadata(schema, sc); | ||
|
|
||
| // additional properties set? | ||
| if (schema.getAdditionalProperties() != null) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Any-type schemas that only declare Prompt for AI agents
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: When the normalizer converts a type-less 3.1 schema that has Prompt for AI agents |
||
| sc.setAdditionalProperties(schema.getAdditionalProperties()); | ||
| } | ||
|
|
||
| return sc; | ||
| } | ||
|
|
||
| // return schema if nothing in 3.1 spec types to normalize | ||
|
|
||
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.
P2: Schemas using
examplesare normalized with those values in the singularexamplefield, so generated examples and downstream consumers can interpret the metadata incorrectly. The copy should preserveexamplesviasetExamples(and leaveexamplesourced only fromgetExample).Prompt for AI agents