mirror of
https://github.com/googleapis/genai-toolbox.git
synced 2026-01-09 15:38:08 -05:00
fix: Remove unnecessary fields from map parameter manifests (#1138)
Previously the `additionalProperties` field manifests returns name, descriptions, authSources etc. that are not needed. These fields are removed for clarity.
This commit is contained in:
@@ -1211,12 +1211,12 @@ func (p *MapParameter) Manifest() ParameterManifest {
|
||||
|
||||
var additionalProperties any
|
||||
if p.ValueType != "" {
|
||||
prototype, err := getPrototypeParameter(p.ValueType)
|
||||
_, err := getPrototypeParameter(p.ValueType)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
valueSchema := prototype.Manifest()
|
||||
additionalProperties = &valueSchema
|
||||
valueSchema := map[string]any{"type": p.ValueType}
|
||||
additionalProperties = valueSchema
|
||||
} else {
|
||||
// If no valueType is given, allow any properties.
|
||||
additionalProperties = true
|
||||
@@ -1236,12 +1236,12 @@ func (p *MapParameter) Manifest() ParameterManifest {
|
||||
func (p *MapParameter) McpManifest() ParameterMcpManifest {
|
||||
var additionalProperties any
|
||||
if p.ValueType != "" {
|
||||
prototype, err := getPrototypeParameter(p.ValueType)
|
||||
_, err := getPrototypeParameter(p.ValueType)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
valueSchema := prototype.McpManifest()
|
||||
additionalProperties = &valueSchema
|
||||
valueSchema := map[string]any{"type": p.ValueType}
|
||||
additionalProperties = valueSchema
|
||||
} else {
|
||||
// If no valueType is given, allow any properties.
|
||||
additionalProperties = true
|
||||
|
||||
@@ -1270,7 +1270,7 @@ func TestParamManifest(t *testing.T) {
|
||||
Required: true,
|
||||
Description: "bar",
|
||||
AuthServices: []string{},
|
||||
AdditionalProperties: &tools.ParameterManifest{Name: "", Type: "string", Required: true, Description: "", AuthServices: []string{}},
|
||||
AdditionalProperties: map[string]any{"type": "string"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1282,7 +1282,7 @@ func TestParamManifest(t *testing.T) {
|
||||
Required: false,
|
||||
Description: "bar",
|
||||
AuthServices: []string{},
|
||||
AdditionalProperties: &tools.ParameterManifest{Name: "", Type: "string", Required: true, Description: "", AuthServices: []string{}},
|
||||
AdditionalProperties: map[string]any{"type": "string"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1350,7 +1350,7 @@ func TestParamMcpManifest(t *testing.T) {
|
||||
want: tools.ParameterMcpManifest{
|
||||
Type: "object",
|
||||
Description: "bar",
|
||||
AdditionalProperties: &tools.ParameterMcpManifest{Type: "string", Description: ""},
|
||||
AdditionalProperties: map[string]any{"type": "string"},
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -1405,7 +1405,7 @@ func TestMcpManifest(t *testing.T) {
|
||||
"foo-map-int": {
|
||||
Type: "object",
|
||||
Description: "a map of ints",
|
||||
AdditionalProperties: &tools.ParameterMcpManifest{Type: "integer", Description: ""},
|
||||
AdditionalProperties: map[string]any{"type": "integer"},
|
||||
},
|
||||
"foo-map-any": {
|
||||
Type: "object",
|
||||
|
||||
Reference in New Issue
Block a user