MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / GetRequestBodiesImports

Function GetRequestBodiesImports

pkg/codegen/codegen.go:1421–1438  ·  view source on GitHub ↗
(bodies map[string]*openapi3.RequestBodyRef)

Source from the content-addressed store, hash-verified

1419}
1420
1421func GetRequestBodiesImports(bodies map[string]*openapi3.RequestBodyRef) (map[string]goImport, error) {
1422 res := map[string]goImport{}
1423 for _, r := range bodies {
1424 response := r.Value
1425 for mediaType, body := range response.Content {
1426 if !util.IsMediaTypeJson(mediaType) {
1427 continue
1428 }
1429
1430 imprts, err := GoSchemaImports(body.Schema)
1431 if err != nil {
1432 return nil, err
1433 }
1434 maps.Copy(res, imprts)
1435 }
1436 }
1437 return res, nil
1438}
1439
1440func GetResponsesImports(responses map[string]*openapi3.ResponseRef) (map[string]goImport, error) {
1441 res := map[string]goImport{}

Callers 1

Calls 2

IsMediaTypeJsonFunction · 0.92
GoSchemaImportsFunction · 0.85

Tested by

no test coverage detected