Repository navigation
Fix OpenAPI floating-point union schema in .NET 10 - #69667
shantanu2002git wants to merge 6 commits into
Conversation
|
Thanks for your PR, @shantanu2002git. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
Hey @shantanu2002git, CI flagged a couple of issues in the test: |
| Assert.NotNull(numberOrStringSchema.Pattern); | ||
|
|
||
| var namedLiteralsSchema = temperatureSchema.AnyOf[1]; | ||
| Assert.Equal(new[] { "NaN", "Infinity", "-Infinity" }, |
There was a problem hiding this comment.
Please assert the full JSON document, similar to what this test does:
There was a problem hiding this comment.
Thanks for the feedback. I’ve updated the regression test to assert the full serialized OpenAPI JSON document, following the pattern from the referenced test.
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Fix OpenAPI floating-point union schema in .NET 10
Summary of the changes (Less than 80 chars)
Fix incorrect object constraint for OpenAPI floating-point unions
Description
Fixes #69604.
When
JsonNumberHandling.AllowNamedFloatingPointLiteralsis enabled, the.NET 10 OpenAPI schema generation can produce an incorrect
objecttypeconstraint for a floating-point property using
anyOf.This makes the generated schema unsatisfiable because numeric values cannot
satisfy the outer
objectconstraint.This change removes the incorrect
JsonSchemaType.Objectassignments whenreading
anyOfandoneOfschemas.A regression test has also been added to verify that named floating-point
literals generate the expected schema without the incorrect outer object
constraint.
This is a servicing fix for the .NET 10 release branch corresponding to the
behavior already corrected on main.
Fixes #69604.