'Swashbuckle / Swagger missing enum information when enum is in path
I have a C# .Net 6 API using Swashbuckle to generate Swagger docs for clients.
I have Swashbuckle.AspNetCore 6.3.1 and *.Filters 7.02 installed.
In Startup.cs, I have
...
swaggerOptions.UseInlineDefinitionsForEnums();
swaggerOptions.SchemaFilter<EnumDescriptionFilter>(); // Custom filter.
...
.AddJsonOptions(options =>
{
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());
})
I have several enums in the APIs that are string serialized. This works great when the enum is in the query string:

However, this doesn't work when the enum is in the path:

I've tried fiddling with the configuration, experimenting with the Annotations package, switching to Newtonsoft, etc. but have had no such luck.
If I change the type of the parameter to string then I get a type of string in the swagger, but I don't get the possible values.
Any idea what I'm missing?
Thanks.
Update. Upon further playing around, in the querystring only List show up correctly. If I add [FromQuery] VehicleType vehicleType to a route, then it shows up without a type.
At the same time, [FromQuery] List<VehicleType> vehicleTypes shows up correctly.
Updated 2: Looks like this is an issue with OpenAPI.NET https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1329#:~:text=Enum%20type%20is%20missing%20%28look%20at%20JustEnum%20in,and%20serialization%20to%20JSON%20behavior%20from%20that%20library.
As per the thread, this is a work around for the bug:
swaggerGenOptions.UseInlineDefinitionsForEnums();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
