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

Question: Working backward from existing Swagger spec? #906

Open
bobspryn opened this issue Jul 22, 2018 · 3 comments
Open

Question: Working backward from existing Swagger spec? #906

bobspryn opened this issue Jul 22, 2018 · 3 comments

Comments

@bobspryn
Copy link

👋

Building my first serverless application here and my head is swimming a bit. I have a defined swagger spec that my mobile client is working against. Swagger has the ability to generate code from a spec for flask, and other similar style frameworks in different languages.

Is there such a thing for chalice? Does that even make sense? Does having an existing spec net me anything here?

Should I use flask instead?

@stealthycoin
Copy link
Contributor

Just for my own clarity, this would be a request to have some tool that takes a swagger document (or some other IDL document) and from that generate a stub of an app.py file to use in Chalice?

Nothing like that currently exists as far as I know. You can always use Chalice to deploy an API and then get the swagger document describing the API from API Gateway and use that to generate clients. This will treat the Chalice app as the source of truth for the API definition.

@bobspryn
Copy link
Author

Right. So there is this: https://github.com/swagger-api/swagger-codegen

Which is used to take a spec and generate various bits for various clients/servers. The main python solution is using Connexion/Flask. It generates some model code, but mostly just hooks up Connexion which points requests in the right direction at runtime based on the swagger.yaml file.

Some solutions are dynamic like that, some just generate your starting stubs.

@bhrutledge
Copy link

Connexion is used by swagger-codegen, but stands on its own as a valdiation, routing, and serialization layer on top of Flask, driven by an existing OpenAPI spec as the source of truth, instead of generating one from Python code.

It looks like there's work underway to make the next major version of Connexion more pluggable, and independent of a particular framework. Perhaps pieces of that could be used in a Chalice app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants