Repository navigation
fix: use the JSON type Jackson writes for scalar types in JSON schemas - #2155
Merged
Merged
Conversation
octonato
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 JSON schemas now use the JSON type that Jackson writes for scalar types. Before this change, the schema did not match the Jackson output for several types:
byte[]URIBigIntegerlowestSetBitURL,Date,ZoneId,Locale,Currency,YearMonthand similar types had the same problem. The wrong schemas reached agent tool inputs, MCP tool input and output schemas, and HTTP endpoint descriptions. An MCP client that checks structured content against the output schema rejected these values.Optional, collection, enum or protobuf message, the schema asks the Jackson format visitor for the JSON type. A string, number, integer or boolean gives a scalar schema. Any other type is introspected as an object, as before. A user class with@JsonValueor a class-level serializer also gets the scalar type.byte[],char[]andByteBufferas arrays but writes them as strings, so these have their own case.OptionalInt,OptionalLongandOptionalDoublegive an integer or number schema and are not required.Stringbody as atext/plainbody. The runtime parses any other body as JSON. AnInstantorUUIDbody was already described wrongly, and this change would have added more types.The test serializes an example with the SDK mapper and checks each JSON value against the schema type.
Reported in the review of #2101.