OpenApi generation OpenApiSchemaComparer fails with null values for Properties, AllOf, or AnyOf #59507
Open
1 task done
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
OpenApiSchemaComparer uses code like
hashCode.Add(obj.Properties.Count);
. In custom schema transforms where I might want to replace allof , anyof, or properties, intuitively I would set unwanted properties to null. Either the setter should prevent this, or theobj.Properties.Count
should beobj.Properties?.Count??0
or otherwise take care of nulls.Expected Behavior
Not crash when a schema property is null.
Steps To Reproduce
Custom schema transform - set Properties to null. OpenApi doc gen and Scalar result have missing elements.
Exceptions (if any)
Object reference not set to an instance of an object.
.NET Version
9
Anything else?
No response
The text was updated successfully, but these errors were encountered: