Skip to content

Commit

Permalink
Merge pull request #2216 from AmaliMatharaarachchi/consul
Browse files Browse the repository at this point in the history
Add gql default support
  • Loading branch information
AmaliMatharaarachchi committed Apr 1, 2024
2 parents e59ab52 + fc3258a commit eb155aa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions adapter/internal/oasparser/envoyconf/routes_with_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,15 @@ func CreateRoutesWithClusters(adapterInternalAPI *model.AdapterInternalAPI, inte
return nil, nil, nil, fmt.Errorf("error while creating routes. %v", err)
}
routes = append(routes, routesP...)
if adapterInternalAPI.IsDefaultVersion {
defaultRoutes, errDefaultPath := createRoutes(genRouteCreateParams(adapterInternalAPI, &resource, vHost, basePath, clusterName, nil, nil, organizationID,
false, true))
if errDefaultPath != nil {
logger.LoggerXds.ErrorC(logging.PrintError(logging.Error2231, logging.MAJOR, "Error while creating routes for API %s %s for path: %s Error: %s", adapterInternalAPI.GetTitle(), adapterInternalAPI.GetVersion(), removeFirstOccurrence(resource.GetPath(), adapterInternalAPI.GetVersion()), errDefaultPath.Error()))
return nil, nil, nil, fmt.Errorf("error while creating routes. %v", errDefaultPath)
}
routes = append(routes, defaultRoutes...)
}
return routes, clusters, endpoints, nil
}
for _, resource := range adapterInternalAPI.GetResources() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ basePath: "/graphql"
version: "3.14"
type: "GRAPHQL"
id: "graphql-without-sub"
defaultVersion: false
defaultVersion: true
subscriptionValidation: false
endpointConfigurations:
production:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ Feature: Generating APK conf for GraphQL API
| 429 |
| 500 |
And the response body should contain "\"name\":\"string\""
Then I set headers
| Authorization | bearer ${accessToken} |
And I send "POST" request to "https://default.gw.wso2.com:9095/graphql" with body "{\"query\":\"{ allHumans { name } }\"}"
And I eventually receive 200 response code, not accepting
| 429 |
| 500 |
And the response body should contain "\"name\":\"string\""

Scenario: Undeploy API
Given The system is ready
Expand Down

0 comments on commit eb155aa

Please sign in to comment.