Comments (2)
As far as I understood we can fix this by not raising https://github.com/Yelp/bravado-core/blob/015a2cd8baf1ecdf0af2739452871ee19bc7b3d1/bravado_core/model.py#L71 exception. However I'm not sure about side effects of this solution 😃
from bravado.
@nikitastupin Thanks a lot for reporting this. I've done some investigations, results are down the comment.
TL;DR; You could configure bravado to not use models in order to workaround the issue.
(venv) maci:~/ $ # It works
(venv) maci:~/ $ python3 -c 'from bravado.client import SwaggerClient; SwaggerClient.from_url("https://firefox.settings.services.mozilla.com/v1/__api__",config={"use_models": False})' &> /dev/null; echo $?
0
(venv) maci:~/ $ # It fails (as reported)
(venv) maci:~/ $ python3 -c 'from bravado.client import SwaggerClient; SwaggerClient.from_url("https://firefox.settings.services.mozilla.com/v1/__api__",config={"use_models": True})' &> /dev/null; echo $?
1
(venv) maci:~/ $ [21:47:32]
Details
The reported issue is caused by the fact that bravado
, using the default configurations, tries to define python classes that represent the models available on the specifications.
NOTE: The models discovery is actually performed by bravado-core
and documented in here.
The python classes are named according to the x-model
attribute, if present, or title
as fallback.
The specifications report multiple usages of title: SchemaNode
, title: ErrorSchema
, etc. (full list at the end of this comment).
In order to prevent failures you might configure the bravado
client to not use models (in this case a warning will be rendered) (documented in here).
A possible improvement (and I would suggest opening it into the bravado-core project) could be to make the model discovery smarter by allowing namesake models to coexist if their definition is exactly the same (as seems happening with the mozilla specifications).
Considering the above mentioned details this does not seems being an issue into bravado, but rather a potential feature request for bravado-core (which I would recommend opening in the correct project).
Full list of duplicated model names
(venv) maci:~/ $ curl --silent https://firefox.settings.services.mozilla.com/v1/__api__ | jq . | grep title | cut -d: -f2 | cut -d'"' -f2 | sort | uniq -dc | sort -n [21:41:32]
2 Cache Expires
2 Collection
2 Members
2 Method
3 Body
3 Headers
3 Path
4 ObjectSchema
4 Permissions
4 Read
4 Write
7 Schema
7 SchemaNode
60 Code
60 Errno
60 Error
60 ErrorSchema
60 Info
60 Message
(venv) maci:~/ $ [21:41:36]
NOTE: The extraction is done in best-effort mode (aka there might be false-positive/false-negative) but is representative enough of the issue.
from bravado.
Related Issues (20)
- Plans for an async-native version of Bravado? HOT 1
- Redirects should not be considered errors
- Content-Type in swagger spec is ignored HOT 1
- Question: How to increase connection pool? HOT 2
- SwaggerClient.from_url should have timeout HOT 2
- follow_redirects config option seems to have no effect HOT 2
- Is SSL two-way authentication supported?
- OverflowError: timeout value is too large HOT 1
- Implement serialization protocol in SwaggerClient class? HOT 2
- Severe performance degradation in uWSGI preforking mode starting from v10.1.0 HOT 2
- Nanosecond datetime precision lost when SwaggerClient parses it HOT 1
- jsonschema 4.0.0 removes `compat` module HOT 6
- bravado.exception.HPPTFound 302 HOT 1
- About the problem of non-200 status code processing HOT 1
- About the request header, how to set multiple request header information, hope to get the answer, preferably covered with examples,thanks HOT 1
- SwaggerClient dealing with the input of a more complex dictionary type, an exception is thrown, and in fact my dictionary meets the requirements HOT 4
- I have a new problem, actually I'm the return value is a standard dictionary, in dealing with the dictionary and bravado, tip me en error HOT 14
- How do I make a request with a sanitizing name `async`? HOT 2
- Attempting to use as Accela client HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bravado.