Commit graph go-sdk/jsonschema/json_pointer.go
Author SHA1 Message Date
Jonathan Amsterdam
d9a7859c3b internal/mcp/internal/util: add Wrapf
Add Wrapf, a function that helps with error wrapping.

Change-Id: I102695f75e4d217e09f828f4723cbfcbbe83f887
Reviewed-on: https://go-review.googlesource.com/c/tools/+/679177
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Sam Thanawalla <samthanawalla@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-09 08:52:39 -07:00
Jonathan Amsterdam
4e9d520c2e internal/mcp/jsonschema: generalize error wrapping
Add a wrapf function to simplify defers that wrap errors.

Change-Id: If4bedec7d3f56f609d3ca4620aebe7637a59f6bf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/676475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
2025-05-27 14:23:27 -07:00
Jonathan Amsterdam
e3938ce68c internal/mcp/jsonschema: clearer validations errors
Validation errors now more clearly indicate the path from the root
schema.

- Enhance schema iteration to yield the path, and generalize it by using
  reflection.

- Store each schema's path inside the schema.

- Remove the path arg from validate: we don't need it anymore.

- Improve the test for the iterators and add one for validation
  errors.

Change-Id: Ief55133ef4ae2eac0736208a3b9f78ed69933b31
Reviewed-on: https://go-review.googlesource.com/c/tools/+/676375
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Jonathan Amsterdam <jba@google.com>
2025-05-27 13:58:26 -07:00
Jonathan Amsterdam
9031106300 jsonschema: implement JSON Pointers for schemas
Implement enough of the JSON Pointer spec to suffice for JSON Schema.

For details, see the comment at the top of json_pointer.go.

Change-Id: Ic297f1a1a08903b4b3c6666fe57ac1f45c96c0f7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/670535
Reviewed-by: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-07 09:31:46 -07:00