OpenApi ignores JsonNumberHandling.WriteAsString #58882
Labels
area-minimal
Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc
feature-openapi
Milestone
Is there an existing issue for this?
Describe the bug
When a property has the attribute
JsonNumberHandling(JsonNumberHandling.AllowReadingFromString|JsonNumberHandling.WriteAsString)
, OpenApi still describes the property with the native type and not a stringExpected Behavior
When using
JsonNumberHandling.WriteAsString
I expect the OpenApi specification to report the propery asstring
Steps To Reproduce
/openapi/v1.json
temperatureC
property is listed as integer:temperatureC
property/weatherforecast
and seetemperatureC
is a string./openapi/v1.json
temperatureC
property is still listed as an integer:Exceptions (if any)
No response
.NET Version
9.0.100-rc.1.24452.12
Anything else?
A workaround is to add a SchemaTransformer like
but this is using reflection and probably missing some other details.
The text was updated successfully, but these errors were encountered: