product-apim
product-apim copied to clipboard
Importing a GQL API without operations in the additionalProperties doesn't create operations in the imported API
Description:
Creating a GQL API by importing an SDL shouldn't require us as to send operation along with the request. If we send the below request, (provide file as gql sdl file) the API will be created with default operations.
curl --location --request POST 'https://localhost:9443/api/am/publisher/v2/apis/import-graphql-schema' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: Bearer <access_token>' \
--form 'type=GraphQL' \
--form 'file=@/home/malintha/wso2apim/cur/apim400/gql/schema.docs.graphql' \
--form 'additionalProperties={
"name":"gh-api",
"version":"1.0.0",
"context":"/gh",
"policies":[
"Unlimited"
],
"endpointConfig":{
"endpoint_type":"http",
"sandbox_endpoints":{
"url":"sample"
},
"production_endpoints":{
"url":"sample"
}
},
"gatewayEnvironments":[
"Production and Sandbox"
]
}'
If we send operations with the request it works.
eg:
--form 'additionalProperties={
"name":"gh-api",
"version":"1.0.0",
"context":"/gh",
"policies":[
"Unlimited"
],
"endpointConfig":{
"endpoint_type":"http",
"sandbox_endpoints":{
"url":"sample"
},
"production_endpoints":{
"url":"sample"
}
},
"operations":[
{
"id":"0",
"target":"acceptEnterpriseAdministratorInvitation",
"verb":"Mutation",
"authType":"Any",
"throttlingPolicy":null,
"scopes":[
],
"usedProductIds":[
],
"amznResourceName":null,
"amznResourceTimeout":null,
"payloadSchema":null,
"uriMapping":null
},
{
"id":"1",
"target":"acceptTopicSuggestion",
"verb":"Mutation",
"authType":"Any",
"throttlingPolicy":null,
"scopes":[
],
"usedProductIds":[
],
"amznResourceName":null,
"amznResourceTimeout":null,
"payloadSchema":null,
"uriMapping":null
}
],
"gatewayEnvironments":[
"Production and Sandbox"
]
}'
Ideally it should take operations from the provided SDL file.
To be prioritized and fixed after APIM 4 release. Currently the 2nd flow works without issues
Importing an updated GraphQL definition breaks an API due to this bug. And there is no way to fix that in the UI but to create a new API. How is this not a high priority?