MCPcopy Create free account
hub / github.com/docker/docker-agent / requestBodySchema

Function requestBodySchema

pkg/tools/builtin/openapi/openapi.go:337–353  ·  view source on GitHub ↗

requestBodySchema extracts the JSON schema from an operation's request body, if any.

(op *v3.Operation)

Source from the content-addressed store, hash-verified

335
336// requestBodySchema extracts the JSON schema from an operation's request body, if any.
337func requestBodySchema(op *v3.Operation) *base.Schema {
338 if op.RequestBody == nil || op.RequestBody.Content == nil {
339 return nil
340 }
341
342 jsonContent, ok := op.RequestBody.Content.Get("application/json")
343 if !ok || jsonContent.Schema == nil {
344 return nil
345 }
346
347 s := jsonContent.Schema.Schema()
348 if s == nil || s.Properties == nil {
349 return nil
350 }
351
352 return s
353}
354
355// schemaProxyToProperty converts a libopenapi SchemaProxy to a JSON Schema property map.
356func schemaProxyToProperty(proxy *base.SchemaProxy) map[string]any {

Callers 1

operationSchemaFunction · 0.85

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected