requestBodySchema extracts the JSON schema from an operation's request body, if any.
(op *v3.Operation)
| 335 | |
| 336 | // requestBodySchema extracts the JSON schema from an operation's request body, if any. |
| 337 | func 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. |
| 356 | func schemaProxyToProperty(proxy *base.SchemaProxy) map[string]any { |