go-sdk/jsonschema
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonathan Amsterdam 435f5447df internal/mcp/jsonschema: support validating structs
The instance passed to Resolved.Validate can be a struct, or can
contain structs. A struct is treated like the JSON object that it
marshals to.

Also support pointers to any depth. That is, if an instance is a **int,
then Validate will treat it like an int (or nil). That won't happen if
the instance is unmarshaled into an `any`, but may if it's unmarshaled
into a struct.

Change-Id: I39f9af58028bd779887495754519615cd5dfb6c8
Reviewed-on: https://go-review.googlesource.com/c/tools/+/670395
Reviewed-by: Alan Donovan <adonovan@google.com>
Auto-Submit: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-06 15:48:51 -07:00
..
testdata/draft2020-12 internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
annotations.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
infer.go internal/mcp/jsonschema: support validating structs 2025-05-06 15:48:51 -07:00
infer_test.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
resolve.go jsonschema: resolve anchors 2025-05-06 03:57:39 -07:00
resolve_test.go jsonschema: resolve anchors 2025-05-06 03:57:39 -07:00
schema.go internal/mcp/jsonschema: support validating structs 2025-05-06 15:48:51 -07:00
schema_test.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
util.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
util_test.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
validate.go internal/mcp/jsonschema: support validating structs 2025-05-06 15:48:51 -07:00
validate_test.go internal/mcp/jsonschema: support validating structs 2025-05-06 15:48:51 -07:00