internal/util: move FieldJSONInfo into jsonschema/util (#251)

This CL effectively removes any dependencies on mcp from jsonschema.
This will enable us to move the repo.
This CL also deletes unused marshalStructWithMap and
unmarshalStructWithMap which had a dependency on FieldJSONInfo.

Fixes: #250
This commit is contained in:
Sam Thanawalla 2025-08-06 12:07:57 -04:00 • committed by GitHub
commit b392875dc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,8 +15,6 @@ import (
"math"
"reflect"
"slices"
"github.com/modelcontextprotocol/go-sdk/internal/util"
)
// A Schema is a JSON schema object.
@ -424,9 +422,9 @@ var (
func init() {
for _, sf := range reflect.VisibleFields(reflect.TypeFor[Schema]()) {
info := util.FieldJSONInfo(sf)
if !info.Omit {
schemaFieldInfos = append(schemaFieldInfos, structFieldInfo{sf, info.Name})
info := fieldJSONInfo(sf)
if !info.omit {
schemaFieldInfos = append(schemaFieldInfos, structFieldInfo{sf, info.name})
}
}
slices.SortFunc(schemaFieldInfos, func(i1, i2 structFieldInfo) int {