Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gql default support #2216

Merged
merged 2 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading