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

Function OperationImports

pkg/codegen/codegen.go:1296–1329  ·  view source on GitHub ↗
(ops []OperationDefinition)

Source from the content-addressed store, hash-verified

1294}
1295
1296func OperationImports(ops []OperationDefinition) (map[string]goImport, error) {
1297 res := map[string]goImport{}
1298 for _, op := range ops {
1299 for _, pd := range [][]ParameterDefinition{op.PathParams, op.QueryParams} {
1300 for _, p := range pd {
1301 imprts, err := OperationSchemaImports(&p.Schema)
1302 if err != nil {
1303 return nil, err
1304 }
1305 maps.Copy(res, imprts)
1306 }
1307 }
1308
1309 for _, b := range op.Bodies {
1310 imprts, err := OperationSchemaImports(&b.Schema)
1311 if err != nil {
1312 return nil, err
1313 }
1314 maps.Copy(res, imprts)
1315 }
1316
1317 for _, b := range op.Responses {
1318 for _, c := range b.Contents {
1319 imprts, err := OperationSchemaImports(&c.Schema)
1320 if err != nil {
1321 return nil, err
1322 }
1323 maps.Copy(res, imprts)
1324 }
1325 }
1326
1327 }
1328 return res, nil
1329}
1330
1331func GetTypeDefinitionsImports(swagger *openapi3.T, excludeSchemas []string) (map[string]goImport, error) {
1332 res := map[string]goImport{}

Callers 1

GenerateFunction · 0.85

Calls 1

OperationSchemaImportsFunction · 0.85

Tested by

no test coverage detected