-
Notifications
You must be signed in to change notification settings - Fork 98
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
Add new 'use_spec_url_for_base_path' boolean config option #300
Add new 'use_spec_url_for_base_path' boolean config option #300
Conversation
UTs still to be updated, but I'd like some feedback first before spending time on those, just to make sure I'm not doing anything that's obviously silly, thanks. |
Hello @macisamuele, @sjaensch, are you able to provide any feedback on this? Thanks |
Gentle bump - @macisamuele , @sjaensch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a big fan of adding configuration parameters that modify the behaviour respect what the official specs.
Anyway checking the threads seems like an approach like this could help with supporting additional use-cases without adding tons of complexity on the configuration understanding and processing.
So overall I'm OK with the approach.
Please make sure to address the opened issue and to create a test to verify that the configured value is used and not used according to the presence of basePath
in the swagger specs.
38be785
to
43efb90
Compare
Updated the doc string and added new tests. |
This new option addresses issues arising from 'basePath' not being present in a given spec. According to the 2.0 spec, "If it is not included, the API is served directly under the host. The value MUST start with a leading slash (/)". 1083636 made the SwaggerClient compliant with the spec (basePath is now implicitly set to '/' if field is missing from spec). However, this broke existing code that utilizes the SwaggerClient (see Issue Yelp#299). The current (spec-compliant) behaviour remains with this new option as it defaults to False. Overriding this default with 'True' means the path element of the URL used to retrieve the spec will be used instead.
43efb90
to
7e7b974
Compare
Fixed failing python3 test (due to urllib differences between python 2 and 3). |
Thanks @macisamuele. |
One last thing @macisamuele - is there an ETA on when this will be released? (Maybe v5.1.0 given that a new option has been added?) Thanks again. |
This new option addresses issues arising from 'basePath' not being
present in a given spec.
According to the 2.0 spec, "If it is not included, the API is served directly
under the host. The value MUST start with a leading slash (/).".
1083636 made the SwaggerClient compliant with the spec (basePath is now
implicitly set to '/' if field is missing from spec). However, this broke
existing code that utilizes the SwaggerClient (see Issue #299).
The current (spec-compliant) behaviour remains with this new option as
it defaults to False. Overriding this default with 'True' means the path
element of the URL used to retrieve the spec will be used instead.