Kong / kong

🦍 The Cloud-Native API Gateway and AI Gateway.
https://konghq.com/install/#kong-community
Apache License 2.0
38.78k stars 4.77k forks source link

[request] Import Swagger 2.0/OAS #334

Closed sonicaghi closed 6 years ago

sonicaghi commented 9 years ago

To prepopulate APIs, authentication and Endpoints inside Kong - perhaps connect with Gelato.

davegolland commented 9 years ago

:+1: for swagger 2.0 support

mmwtsn commented 9 years ago

+1

t1tcrucible commented 9 years ago

+1

zeeshanejaz commented 9 years ago

Is there any details on this feature request? Kong works like a proxy, so details of Endpoints shouldn't even be required. What am I missing?

tlivings commented 9 years ago

Going out on a limb and imagining that the request is to consume Swagger API documents and auto-configure the proxies to them, including consuming and wiring up the security definitions contained in them.

As far as endpoints I think it would simply be consuming host and basePath.

This is a great idea but should be relatively trivial to push these configurations to Kong's REST api directly rather than require Kong to do any work.

thibaultcha commented 9 years ago

I totally agree with that thought. It is very trivial to do it without a plugin.

sonicaghi commented 8 years ago

example of one way of doing it http://docs.aws.amazon.com/apigateway/latest/developerguide/create-api-using-import-export-api.html

yograterol commented 8 years ago

someone working in this feature?

apur commented 8 years ago

+1

mytototo commented 8 years ago

Any news regarding an open-source Swagger/OpenAPISpec plugin for Kong?

tahaiqbalkhan9 commented 7 years ago

+1 Any updates regarding this feature?

fontanaricardo commented 7 years ago

Would be nice, if the kong, can also generate one swagger json, from the added APIs and microservices, adding information about kong's resources for this API (authentication by example).

Marak commented 7 years ago

I've written a basic script in Node.js which can load the petstore Swagger 2.0 document and import it into the Kong Admin API.

Basic parsing / import script is simple. Using plain JavaScript and a separate simple REST client for Kong Admin API.

Unfortunately, it seems it's not possible to fully import petstore due to lack of regex routing of request_path in Kong #677

A possible workaround with the current version of Kong is to omit the named routes from petstore and use a proxy. Considering this defeats the purpose of setting up granular routes based on Swagger, we had to choose to drop the Swagger import feature ( for now ).

In addition, multiple Swagger imports per single Kong instance is blocked by #369 ( as conflicting request_path namespaces in separate Swagger files will currently prevent APIs from importing )

cc @thibaultcha

paiuolo commented 7 years ago

+1

koolay commented 7 years ago

+1

liu0013 commented 7 years ago

+1

mward29 commented 7 years ago

+1

psbateman commented 7 years ago

+1

chrisfelix82 commented 7 years ago

+1

vintuwei commented 7 years ago

+1

mwaaas commented 7 years ago

+1

phamnamlong commented 7 years ago

+1

coopr commented 6 years ago

Hi Everybody - I'm the Product Manager here at Mashape, and I'd love to hear some more details of what you'd like to see in a feature like this! Tell me about your use case, about the problems you are trying to solve, about how you'd like Kong to help you solve them with Swagger / OpenAPI Spec.

Reply herein, or email me cooper@mashape.com - thanks in advance!

mwaaas commented 6 years ago

Onboarding api via swagger file and maybe a flag to turn on when to do request validation before forwarding request to upstream.

I have actually managed to do this by a node app parsing the swagger file and onboard the api. And a plugin to forward the request and its content to the node service before forwarding the request to upstream servers.

If I get time I might convert the node app to Lua app then contribute to Kong

nhuray commented 6 years ago

@mwaaas Do you have news about migrating your node app to Lua ?

gfiehler commented 6 years ago

@coopr I am evaluating API gateways and we have a requirement to be able to upload our swagger api documents to create APIs in the gateway. We do contract first design with the swagger editor and would like to be able to just import them to create the base api in the gateway. Any word on tools or new features to support this?

coopr commented 6 years ago

@gfiehler it'd be great to move this discussion to Kong Nation https://discuss.konghq.com/c/feature-suggestions thanks.

Tieske commented 4 years ago

Just for reference; This feature has been added to Kong Enterprise (from 0.36-x versions). A commandline utility openapi2kong is included.

rjshrjndrn commented 3 years ago

will this feature available for kong open source? @Tieske

mikaello commented 3 years ago

will this feature available for kong open source? @Tieske

I think the utility that Tieske is talking about is this: https://www.npmjs.com/package/openapi-2-kong

Original source: https://github.com/Kong/insomnia/tree/develop/packages/openapi-2-kong Rewrite in TypeScript: https://github.com/mikaello/openapi-2-kong

See also discussion in Kong nation.

Tieske commented 3 years ago

@rjshrjndrn It is available in Insomnia Designer, and through the inso commandline utility