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:
parent
e00c485969
commit
b392875dc5
1 changed files with 82 additions and 264 deletions
|
|
@ -14,8 +14,6 @@ import (
|
|||
"reflect"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/internal/util"
|
||||
)
|
||||
|
||||
// ForOptions are options for the [For] function.
|
||||
|
|
@ -192,8 +190,8 @@ func forType(t reflect.Type, seen map[reflect.Type]bool, ignore bool, schemas ma
|
|||
|
||||
for i := range t.NumField() {
|
||||
field := t.Field(i)
|
||||
info := util.FieldJSONInfo(field)
|
||||
if info.Omit {
|
||||
info := fieldJSONInfo(field)
|
||||
if info.omit {
|
||||
continue
|
||||
}
|
||||
if s.Properties == nil {
|
||||
|
|
@ -216,9 +214,9 @@ func forType(t reflect.Type, seen map[reflect.Type]bool, ignore bool, schemas ma
|
|||
}
|
||||
fs.Description = tag
|
||||
}
|
||||
s.Properties[info.Name] = fs
|
||||
if !info.Settings["omitempty"] && !info.Settings["omitzero"] {
|
||||
s.Required = append(s.Required, info.Name)
|
||||
s.Properties[info.name] = fs
|
||||
if !info.settings["omitempty"] && !info.settings["omitzero"] {
|
||||
s.Required = append(s.Required, info.name)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue