-
-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Labels
area/contribIndicates an issue on contrib area.Indicates an issue on contrib area.kind/bug/confirmed
Description
I'm using the DispatcherMiddleware from Werkzeug to nest my application under /api/v1
. In my spec, I have http://localhost:3991/api/v1
listed under servers
. When I make a request to http://localhost:3991/api/v1/accounts
I get the following error:
openapi_core.templating.paths.exceptions.ServerNotFound: Server not found for http://localhost:3991/accounts
Notice that the library interprets the url incorrectly, it just appends the /accounts
endpoint from my spec to the hostname rather than to the full base url. There are two things that need changed for this to be fixed:
- In lines 37 and 39 of openapi_core/templating/paths/finders.py urls are joined with urljoin, which removes everything after the hostname. E.g.
https://test.com/test1
joined to/test2
would yieldhttps://test.com/test2
. A different function would have to be used - The requests from the library expect a host_url when it should probably be a base url. There would need to be a way to find this base url in the flask response transformer, but I'm sure it could be done.
An easier solution that would work for now would be to add an option to disable server validation. I'd be glad to submit a PR to do that or to fix the above issue, I just want to get confirmation before I work on the PR.
Metadata
Metadata
Assignees
Labels
area/contribIndicates an issue on contrib area.Indicates an issue on contrib area.kind/bug/confirmed