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
I have a Minimal API. In previous versions of this library I had to patch the generated schema to have tags in the schema next to file (-> properties of schema object).
I heard, in the newer versions of this library [FromForm] is better supported, so I tried that.
Unfortunately, one of my endpoints relying on [FromForm] yields a schema that is incorrect.
This schema would mean, that the body is a mix of a string (tags) and something with a property file that is a binary file (⚠ note the allOf). That is incorrect.
Note
A simpler version without file also shows this behavior (but with skipping allOf).
Note
As to be expected, Swagger UI is also not able to display a tags input anywhere
Steps to reproduce
Create new minimal API project with .NET 8 from template
Configure to use swagger gen
Add endpoint like in example
Update Swagger libraries
Browse to the generated swagger.json and inspect generated OpenAPI schema
Exception(s) (if any)
No response
Swashbuckle.AspNetCore version
6.8.1
.NET Version
net8.0
Anything else?
No response
The text was updated successfully, but these errors were encountered:
I am working on it. It's a fix over the PRs: #2979, #2972 and #2963.
The problem that the previous version had is that if there is no schema it has to create the properties and so on.
The AllOf is OK (Because the implementation of Microsoft.AspNetCore.OpenApi does just the same (if there is more than one element then it creates an AllOf node.
Describe the bug
I have a Minimal API. In previous versions of this library I had to patch the generated schema to have
tags
in the schema next tofile
(-> properties of schema object).I heard, in the newer versions of this library
[FromForm]
is better supported, so I tried that.Unfortunately, one of my endpoints relying on
[FromForm]
yields a schema that is incorrect.I have a Minimal API with the following action:
Note
A simpler version without
file
also shows this behavior.Expected behavior
It should generate:
Note
Please note the
file
andtags
properties in the schema. This way I can send a tags string alongside the binary file payload.Note
tags
inencoding
is just a guess on my side.Actual behavior
It generates:
This schema would mean, that the body is a mix of a string (
tags
) and something with a propertyfile
that is a binary file (⚠ note theallOf
). That is incorrect.Note
A simpler version without
file
also shows this behavior (but with skippingallOf
).Note
As to be expected, Swagger UI is also not able to display a
tags
input anywhereSteps to reproduce
swagger.json
and inspect generated OpenAPI schemaException(s) (if any)
No response
Swashbuckle.AspNetCore version
6.8.1
.NET Version
net8.0
Anything else?
No response
The text was updated successfully, but these errors were encountered: