Skip to content

Commit 58afa9f

Browse files
Merge pull request #421 from cloudnautique/drop_readonly
fix: do not add readOnly fields to the requestBody
2 parents 18a74f0 + 8451f14 commit 58afa9f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/loader/openapi.go

+6
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ func getOpenAPITools(t *openapi3.T, defaultHost string) ([]types.Tool, error) {
199199
arg.Description = content.Schema.Value.Description
200200
}
201201

202+
// Read Only can not be sent in the request body, so we remove it
203+
for key, property := range arg.Properties {
204+
if property.Value.ReadOnly {
205+
delete(arg.Properties, key)
206+
}
207+
}
202208
// Unfortunately, the request body doesn't contain any good descriptor for it,
203209
// so we just use "requestBodyContent" as the name of the arg.
204210
tool.Parameters.Arguments.Properties["requestBodyContent"] = &openapi3.SchemaRef{Value: arg}

0 commit comments

Comments
 (0)