Boavizta / boaviztapi

🛠 Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
66 stars 23 forks source link

Broken OpenAPI doc links when deployed as serverless #99

Closed demeringo closed 2 years ago

demeringo commented 2 years ago

Bug description

There remain a problem with the links in openapi doc that do not include the default stage prefix used when deploying with the serverless framework.

The OpenAPI doc is well served and displayed but the links used to test the API do not work.

Note: this issue would disappear if using a custom domain (like dev.boa.my-domain.com and prod/boa.my-domain.com).

For example: OpenAPI is pointing to this URL (without the dev prefix):

https://1rq5nf92sb.execute-api.eu-west-1.amazonaws.com/v1/server/all_default_models

while content is served from the same URL (but with the dev prefix):

https://1rq5nf92sb.execute-api.eu-west-1.amazonaws.com/**dev**/v1/server/all_default_models

Expected behavior

Open API spec links should work in sls deployment

JSON OUTPUT

Additional context

Related issues that may be helpfull

demeringo commented 2 years ago

https://fastapi.tiangolo.com/advanced/behind-a-proxy/

demeringo commented 2 years ago

The trik seems to use root_path instead of openapi_prefix see

demeringo commented 2 years ago

Commit 6fe3498895a5680fa7e94ad27ddfba52f5c14b0b should fix it.

da-ekchajzer commented 2 years ago

Can I close this issue since https://github.com/Boavizta/boaviztapi/commit/6fe3498895a5680fa7e94ad27ddfba52f5c14b0b has been merged?

demeringo commented 2 years ago

Yes, thanks, I close it now.