Swashbuckle.AspNetCore icon indicating copy to clipboard operation
Swashbuckle.AspNetCore copied to clipboard

Fix casing of enum keys in a dictionary with CamelCasePropertyNamesContractResolver

Open j2ghz opened this issue 6 months ago • 0 comments

Pull Request

The issue or feature being addressed

Instead of opening an issue I made a PR with a failing test and a possible fix

When using CamelCasePropertyNamesContractResolver, the serializer will use enum keys in camelCase, but the schema will have PascalCase.

Details on the issue fix or feature implementation

Added a test to check that the keys the schema generator produces appear in the output produced by the same serializer. Added a fix that runs the keys through the actual serializer instead of assuming they will be serialized as-is.

j2ghz avatar Aug 23 '24 22:08 j2ghz