Skip to content

Improper handling of type compatibility in allOf clauses for OpenAPI 3.1 Spec #2748

@yrosen-infinidat

Description

@yrosen-infinidat

Since OpenAPI 3.1, the type schema field can now be a list, for example:

"type": ["string", "null"]

Would mean that the schema can be a string or null.

Redoc verifies that when "overriding" a property with allOf, the type is identical (see here). But the check is done using ===, which does not work well for lists, hence I'm getting this error:

Incompatible types in allOf at "/properties/error/properties/code": "string,null" and "string,null"

Expected behavior
If both types in the parent and child schema are ["string", "null"], there shouldn't be an error.
The solution is probably to modify the comparison to be smarter than a simple ===.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions