You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The explode property is not serialized because it has [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, PropertyName = "explode")] applied and false is the default value in C#. Because false is the default value, it's never serialized to JSON.
I can work around this by creating a custom OpenApiParameter derived class that has its own JsonPropertyAttribute to serialize the value - but this only works at runtime and not when generating the spec using nswag.exe. I'm not sure why that is, but I suspect the command line tool deserializes the generated spec and re-serializes it, and when it does so it doesn't have my overridden OpenApiParameter.
The text was updated successfully, but these errors were encountered:
I'm stealing this bug report from domaindrivendev/Swashbuckle.AspNetCore#1212, as NSwag has the same issue.
As per the openapi parameter specification for Query Parameters, when the
style
is set toform
, the defaultexplode
value istrue
.When adding a parameter like so:
This serializes to:
The
explode
property is not serialized because it has[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore, PropertyName = "explode")]
applied andfalse
is the default value in C#. Becausefalse
is the default value, it's never serialized to JSON.I can work around this by creating a custom
OpenApiParameter
derived class that has its ownJsonPropertyAttribute
to serialize the value - but this only works at runtime and not when generating the spec using nswag.exe. I'm not sure why that is, but I suspect the command line tool deserializes the generated spec and re-serializes it, and when it does so it doesn't have my overriddenOpenApiParameter
.The text was updated successfully, but these errors were encountered: