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
When trying to inspect the API for getting products using swagger ui, I get a resolver issue for the EnumA, because the in the generated json file there's not definition in components/schemas for the EnumA even though it is referenced in the paths section of the json. Something like this
//paths section of the json
{
"name": "ExampleA",
"in": "query",
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/EnumA"
}
]
}
}
I tried a few things,
removing c.UseAllOfToExtendReferenceSchemas(); will actually fix this behaviour but, removing this options is not something that suits my needs
changingthe annotation of the parameter from [FromQuery] to -> [FromBody] will also fix this behaviour and have the component/schema for this Enum be generated, but also this options is something that doesn't suit my need
creating a DocumentFilter and trying to manually add this enum for the schema definitions using something like
swaggerDoc.Components.Schemas.Add("EnumA") .... will throw and error because swashbuckle has this Enum referenced at runtime but somehow it's not outputed in the final json file
Tips? (Swashbuckle 5.6.3)
The text was updated successfully, but these errors were encountered:
I have the following structure
//controller
GetProducts(string id, [FromQuery] Product)
//Product.cs class contains an enum member
Product {EnumA ExampleA}
//startup.cs
services.AddSwaggerGen(c =>
{
c.UseAllOfToExtendReferenceSchemas();
}
When trying to inspect the API for getting products using swagger ui, I get a resolver issue for the EnumA, because the in the generated json file there's not definition in components/schemas for the EnumA even though it is referenced in the paths section of the json. Something like this
//paths section of the json
{
"name": "ExampleA",
"in": "query",
"schema": {
"allOf": [
{
"$ref": "#/components/schemas/EnumA"
}
]
}
}
I tried a few things,
swaggerDoc.Components.Schemas.Add("EnumA") .... will throw and error because swashbuckle has this Enum referenced at runtime but somehow it's not outputed in the final json file
Tips? (Swashbuckle 5.6.3)
The text was updated successfully, but these errors were encountered: