-
Notifications
You must be signed in to change notification settings - Fork 338
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
Wildcard field contains an extra nested level in docs #57
Comments
Hello, I'm not sure this is related to #24. Here is the initial PR that introduced this feature: noirbizarre/flask-restplus#255 (comment) As you can see, I already questioned about the resulting swagger, but at that time, nobody reacted to this limitation. @SteadBytes, @j5awry do you think we could improve the Wildcard representation in the swagger? |
Hello @ziirish , {
"field1": "value1",
"nested_and_dynamic_keys": {
"wildcard_field1": {
"foo": "bar",
"alice": "bob"
},
"wildcard_field2": {
"foo": "rba",
"alice": "bbo"
}
}
} But I got this instead: {
"field1": "value1",
"nested_and_dynamic_keys": {
"*": {
"wildcard_field1": {
"foo": "bar",
"alice": "bob"
},
"wildcard_field2": {
"foo": "rba",
"alice": "bbo"
}
}
}
} Is there a way to get the first result or is it really a bugfix/new feature? |
I also wanted this. I could get it to display how I wanted by taking out the Nested model, and having the wildcard field being referenced directly - but this functionally was wrong. So I ended up just being okay with the display looking looking a little off. Nevertheless if this is resolved that would be cool! :) for me, model definition:
desired output:
actual output:
|
Actually, I didn't find yet a swagger definition that matches a model with wildcard fields. |
I would expect a wildcard to be a pattern. https://swagger.io/specification/#schemaObject In the yaml style:
So a wildcard in a nested field would be:
I don't have access to some of the examples I made in the past at the moment...and sadly won't for roughly a month. I'll try and mock this up |
@ziirish Here is an example of swagger definition for wildcard :
The example output show in Swagger :
|
It seems like wildcards can't live in the root level of the object with |
@ziirish I suffer from this behavior as well and in my opinion this is clearly a bug as @FloLaco showed. Shall I make a PR which "fixes" this? Maybe with a new default pre-set parameter like |
Is there some solution / workaround for this issue? |
This might be related to the recent wildcard field changes, e.g. #24.
When using a wildcard field with nested models, the resulting documentation contains three levels:
*
,<*>
, and the nested model, where I would expect just two: The key<*>
and the nested model. Example values in the doc also contains an extra nested level.Please note, the actual output of the marshaled model in get is correct, only the swagger doc is wrong.
Code
Repro Steps (if applicable)
Actual model doc
Expected model doc
Only one level of *, not two.
Actual example value doc
Expected example value doc
or
Actual output of get (correct)
Environment
The text was updated successfully, but these errors were encountered: