-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Added Explode and Style to SwaggerParameter #3065
base: master
Are you sure you want to change the base?
Conversation
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.
Could you add at least one integration/verification test that shows the rendered effect of the new properties in an OpenAPI document please?
src/Swashbuckle.AspNetCore.Annotations/SwaggerParameterAttribute.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.Annotations/SwaggerParameterAttribute.cs
Outdated
Show resolved
Hide resolved
src/Swashbuckle.AspNetCore.Annotations/SwaggerParameterAttribute.cs
Outdated
Show resolved
Hide resolved
This could close the issue #2248 |
@aberus Thanks for responding to the review suggestions. This still needs tests before we can merge it though. |
@martincostello I plan to add tests. But also I think that generation need to be changed, to support these two scenarions. The default ASP.NET model binding parses the query
The custom model binding (
Both of these scenarios should produce this:
Let me know, what do you think? |
How would you propose adding metadata (i.e. an attribute) indicating that the parameters should be treated that way to both ASP.NET Core and Swashbuckle? The issue points to a Stack Overflow answer, which points to a blog post, which mentions a custom implementation of ASP.NET Core model binding. We wouldn't want to be shipping model binders in Swashbuckle, because that's not specific to OpenAPI. |
My suggestion in first example is that a non-collection parameter combination with explode set to false, should generate an array in the OpenAPI specification. |
Pull Request
The issue or feature being addressed
It is currently not possible to set Explode and Style on the parameter.
Details on the issue fix or feature implementation
Added
bool Explode
andstring Style
with backing propertiesbool? ExplodeFlag
andMicrosoft.OpenApi.Models.ParameterStyle? ParameterStyle
respectively.AnnotationsParameterFilter
applies these two properties if set.