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

API: Remove dependency on swagger-cli bundle #539

Closed
paulespinosa opened this issue Jul 18, 2023 · 5 comments · Fixed by #554
Closed

API: Remove dependency on swagger-cli bundle #539

paulespinosa opened this issue Jul 18, 2023 · 5 comments · Fixed by #554

Comments

@paulespinosa
Copy link
Member

Overview

The API currently needs to bundle the OpenAPI specification YAML files located in the API source code under openapi_server/openapi into a single file using the swagger-cli bundle tool because the connexion framework does not support the specifications spread across files. This issue is to remove this requirement so that the OpenAPI specification files in openapi_server/openapi can be used directly by the API code.

Action Items

Research getting connexion to use the openapi_server/openapi spec files. Take a look at the comment on the connexion issue Breaking up large swagger.yaml files
for ideas.

Resources/Instructions

spec-first/connexion#254 - a connexion issue about this problem
https://python-jsonschema.readthedocs.io/en/stable/referencing/ - the underlying library that parses the specs
https://referencing.readthedocs.io/en/stable/ - a referencing library used by jsonschema might have the ability to piece together separate files

@erikguntner
Copy link
Collaborator

Looks like prance could potentially be what we are looking for.
spec-first/connexion#254 (comment)

@paulespinosa
Copy link
Member Author

Looks like prance could potentially be what we are looking for. spec-first/connexion#254 (comment)

This looks very promising.

@erikguntner
Copy link
Collaborator

Looks like this is fixed in Connexion 3, which is currently in Alpha.

spec-first/connexion#1648

@erikguntner
Copy link
Collaborator

erikguntner commented Jul 26, 2023

It worked! I'll try to open a PR tonight. I just need to replace where _spec was being referenced.

@paulespinosa
Copy link
Member Author

Looks like this is fixed in Connexion 3, which is currently in Alpha.

spec-first/connexion#1648

It's good to see they are addressing this. Too bad it's still in Alpha at the moment, but can be something to look forward to.

paulespinosa added a commit that referenced this issue Jul 28, 2023
The application's root path is used to form the path to the `openapi.yaml`
definition. This makes it so the path to the `openapi.yaml` file is relative to
the python module's location instead of the directory where the module is invoked.
For example, the module could be installed into `site-packages` and run from `/opt/HomeUniteUs`.

Related #539
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants