TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.73k stars 1.09k forks source link

When api is created via tyk gateway api, api_id is empty #4004

Closed cuttingedge1109 closed 2 years ago

cuttingedge1109 commented 2 years ago

Branch/Environment/Version

Describe the bug When a new API is created by gateway api /tyk/apis, api_id field is not generated by tyk gateway. It seems api json file is generated with the name ${api_id}.json in /opt/tyk-gateway/appsdir. But because of emptyapi_id, only one file -.jsonfile is always generated for any api creation. It means I can only create one API because the latter api is overwriting.json` file with its spec.

I can pass api_id in the POST request data when create a new api but api_id should be generated by gateway uniquely, i think.

Reproduction steps Create a new api without api_id field in POST request data.

Expected behavior api_id should be generated by api_gateway and it should be returned as response data.

Configuration (tyk config file): Used default config for on-premise tyk-gateway.

lghiur commented 2 years ago

@cuttingedge1109 this is not actually a bug, since this is the way it was built. The expectation is that, in the OSS GW, the 'api_id' is provided in request payload, and users store internally a mechanism for generating these.

We do the same in our projects where we use the GW (like tyk-operator or Dashboard).

Thanks for raising this up !

cuttingedge1109 commented 2 years ago

Thank you @lghiur