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

Function GetResponsesImports

pkg/codegen/codegen.go:1440–1457  ·  view source on GitHub ↗
(responses map[string]*openapi3.ResponseRef)

Source from the content-addressed store, hash-verified

1438}
1439
1440func GetResponsesImports(responses map[string]*openapi3.ResponseRef) (map[string]goImport, error) {
1441 res := map[string]goImport{}
1442 for _, r := range responses {
1443 response := r.Value
1444 for mediaType, body := range response.Content {
1445 if !util.IsMediaTypeJson(mediaType) {
1446 continue
1447 }
1448
1449 imprts, err := GoSchemaImports(body.Schema)
1450 if err != nil {
1451 return nil, err
1452 }
1453 maps.Copy(res, imprts)
1454 }
1455 }
1456 return res, nil
1457}
1458
1459func GetParametersImports(params map[string]*openapi3.ParameterRef) (map[string]goImport, error) {
1460 res := map[string]goImport{}

Callers 1

Calls 2

IsMediaTypeJsonFunction · 0.92
GoSchemaImportsFunction · 0.85

Tested by

no test coverage detected