Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tharsanan1 committed Apr 9, 2024
1 parent 655669d commit 4fb1463
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions apim-apk-agent/pkg/managementserver/rest_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ type APIOperation struct {

// OpenAPIPaths represents the structure of the OpenAPI specification YAML file
type OpenAPIPaths struct {
Paths map[string]map[string]Operation `yaml:"paths"`
Paths map[string]map[string]interface{} `yaml:"paths"`
}

// Operation represents the structure of an operation within the OpenAPI specification
Expand Down Expand Up @@ -383,13 +383,7 @@ func extractOperations(event APICPEvent) ([]APIOperation, []ScopeWrapper, error)
}

for path, operations := range openAPIPaths.Paths {
for verb, operation := range operations {
if operation.XAuthType == "" {
operation.XAuthType = "Application & Application User"
}
if operation.XThrottlingTier == "" {
operation.XThrottlingTier = "Unlimited"
}
for verb, _ := range operations {
ptrToOperationFromDP := findMatchingAPKOperation(path, verb, event.API.Operations)
if ptrToOperationFromDP == nil {
continue
Expand All @@ -410,8 +404,8 @@ func extractOperations(event APICPEvent) ([]APIOperation, []ScopeWrapper, error)
apiOp := APIOperation{
Target: path,
Verb: verb,
AuthType: operation.XAuthType,
ThrottlingPolicy: operation.XThrottlingTier,
AuthType: "Application & Application User",
ThrottlingPolicy: "Unlimited",
Scopes: scopes,
}
apiOperations = append(apiOperations, apiOp)
Expand Down

0 comments on commit 4fb1463

Please sign in to comment.