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
Can't create servers object using APISpec class #534
Comments
I don't get it.
Unless the type provided for kwargs should be understood as the type of the arguments, not of the kwargs dict itself? On one hand, kwargs is always a dict, so specifying the type is not so useful. On the other hand, you can't really specify the type of the kwargs themselves since each argument can have its own type. Is this documented anywhere? |
Using
the generated yaml contains the following:
which is obviously not correct, since there should not be the |
Can you please paste here the instantiation of |
Here it is.
|
Can't reproduce. Here's what I get with your code: {'info': {'description': 'A description',
'title': 'My API Documentation',
'version': '1.0.0',
'x-logo': {'url': 'images/test.png'}},
'openapi': '3.0.2',
'paths': OrderedDict(),
'servers': [{'url': 'https://localhost'}]} Closing for now. Please comment if you want to add clarification. |
Question remains unanswered. Do you have clean solution for this? |
Seems more cleaner way is this
source is here |
Which part of the question is unanswered? I get the correct result with the code the OP posted. What's wrong with this code and how is yours cleaner? You seem to prefer the YAML form, which is fine. I don't use YAML and I'm happy with the dict form. Both are acceptable. What's the issue? |
the question is how to pass the settings as an array (because from the spec it should be an array) if the |
and yes, results are the same |
OK so my understanding is that when documenting kwargs, we wrote
because options is a dict (by nature, since it is kwargs). This is not really helpful since kwargs are always dicts. It seems that the type applies not to I guess our best move is to just remove the type indication, isn't it?
And check we didn't do the same elsewhere in the code. I searched a bit on the Internet and didn't find any definitive answer. |
I don't have any specific thoughts, but tend to agree with you that removing the type indication is the best way to go. |
Should be fixed in #628. |
As per specification, the "servers" object type should be an array/list. This is an example:
To translate this in apispec, I should add the following parameter to the class:
However, the class APISpec only allows objects of type dictionary for
**options
.In any IDE this results in a warning about wrong type.
I solved the issue modifying line 184 of
core.py
in this way:The text was updated successfully, but these errors were encountered: