go-sdk/jsonschema
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jonathan Amsterdam 2a09582fa4 jsonschema: dynamic references
A dynamic reference is like a dynamic variable in a programming
language, with two twists:

- There must be a dynamic anchor in lexical scope for the ref to
  resolve. (Think of it as declaring the dynamic variable.)

- The ref resolves to the schema highest on the stack, not lowest.
  That feels odd, but it turns out to work for the intended purpose,
  which is to provide extension points for additional features.

There is some distracting code motion and refactoring in this CL:
resolveRefs was moved down in the file, and resolution of a single
ref was split off.

Change-Id: I17da6052e0782fc540d14b8a41b06a2645923872
Reviewed-on: https://go-review.googlesource.com/c/tools/+/674155
Auto-Submit: Jonathan Amsterdam <jba@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21 05:05:04 -07:00
..
meta-schemas/draft2020-12 jsonschema: resolve remote references 2025-05-13 11:46:13 -07:00
testdata jsonschema: dynamic references 2025-05-21 05:05:04 -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
json_pointer.go jsonschema: implement JSON Pointers for schemas 2025-05-07 09:31:46 -07:00
json_pointer_test.go jsonschema: implement JSON Pointers for schemas 2025-05-07 09:31:46 -07:00
resolve.go jsonschema: dynamic references 2025-05-21 05:05:04 -07:00
resolve_test.go jsonschema: dynamic references 2025-05-21 05:05:04 -07:00
schema.go jsonschema: dynamic references 2025-05-21 05:05:04 -07:00
schema_test.go internal/mcp/jsonschema: make Schema.every fully recursive 2025-05-07 16:17:56 -07:00
util.go jsonschema: resolve refs 2025-05-08 08:56:49 -07:00
util_test.go internal/mcp: move jsonschema out of mcp/internal 2025-05-05 13:17:44 -07:00
validate.go jsonschema: dynamic references 2025-05-21 05:05:04 -07:00
validate_test.go jsonschema: dynamic references 2025-05-21 05:05:04 -07:00