domaindrivendev / Swashbuckle.AspNetCore

Swagger tools for documenting API's built on ASP.NET Core
MIT License
5.25k stars 1.31k forks source link

Enum query parameter documented as int values #1515

Closed mercer closed 4 years ago

mercer commented 4 years ago

Swagger api for an endpoint that accepts an enum query is generated as in values.

I'm with Swashbuckle.AspNetCore.SwaggerGen 5.0.0 and netcoreapp2.2

image

The enum I use

image

My controller

image

Generated swagger api

image

Swashbuckle.AspNetCore.SwaggerGen 4.0.0 used to generate proper enum values

image

domaindrivendev commented 4 years ago

Dup of #1459. TL;DR this version defaults to honoring System.Text.Json (as opposed to Newtonsoft) serializer behavior. You need to expicitly opt-in to honoring Newtonsoft as described here in the readme

mercer commented 4 years ago

I'm with netcoreapp2.2, does this still apply? https://github.com/domaindrivendev/Swashbuckle.AspNetCore#systemtextjson-stj-vs-newtonsoft talks about netcoreapp3.0

mercer commented 4 years ago

It does apply; problem solved

image