Skip to content

OpenApi generation OpenApiSchemaComparer fails with null values for Properties, AllOf, or AnyOf #59507

Open
@FrankSzendzielarz

Description

@FrankSzendzielarz

Is there an existing issue for this?

  • I have searched the existing issues

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 the obj.Properties.Count should be obj.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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-openapi

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions