Skip to content

[v10.1.1] SwaggerParser.dereference not ignoring $ref sibling properties (OpenAPI 3.1.0 requestBody) #274

Open
@Jaydeepkakadiya19

Description

@Jaydeepkakadiya19

In OpenAPI 3.1.0, sibling properties of $ref (except summary and description) in Reference Objects should be ignored (https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#reference-object).

However, when dereferencing my 3.1.0 definition with @apidevtools/swagger-parser (v10.1.1), sibling properties in the requestBody schema are not ignored. For example, at

 paths -> /customer -> post -> requestBody -> content -> application/json -> schema

in the dereferenced output (see CodeSandbox: https://codesandbox.io/p/sandbox/swagger-ui-forked-f627d8 ), the sibling example and type are being used instead of those in the referenced schema.

Expected: Sibling properties (like example, type) should be ignored, inheriting only from the referenced schema.

Observed: Sibling properties are being processed and taking precedence.

Please do let me know if I misunderstood or missed any Openapi rules here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions