- ABP Framework version: v4.4
- UI type: Angular
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
- Exception message and stack trace:
- Steps to reproduce the issue:
Hello ABP team. I want to change the configuration of swashbuckle to represent enums as strings in the swagger UI. I couldn't find any up to date documentation about this. Also, if possible, can you confirm that string values are already converted to enums? I checked the available converters in AbpSystemTextJsonSerializerOptions and spotted this converted: AbpStringToEnumConverter
Thanks Alex
3 Answer(s)
-
0
Hi, actually this is not related to ABP but Swashbuckle/Swagger. But I want to give you some instructions to how to do this,
- You can use the
Unchase.Swashbuckle.AspNetCore.Extensions
package and follow these steps. - If you don't want to use external package, you can create a new
SchemaFilter
and define it in your configuration. Check this Stackoverflow answer for this.
- You can use the
-
0
Hey ,
Thanks for the pointers. I installed the mentioned extension and now it works. From my understanding, this should have worked out of the box if there is a StringToEnum converter involved. Maybe it would be good to add this pointers to your documenation, under json.
In the end, I ended up adding the following line options.AddEnumsWithValuesFixFilters(); , under context.Services.AddAbpSwaggerGenWithOAuth
-
0
Hi again @alex@livemobility.com, thanks for your suggestion. I will update the documentation.
I close the question since it seems your problem is resolved. Thanks again.