Skip to content

Figuring out $ref and $id in OAS v3.1 in general #2100

Closed
@philsturgeon

Description

@philsturgeon

@darrelmiller

Is it expected that two distinct OAS Schema Objects would be able to refer to each other using canonical Ids?

yes

If the above example is possible, then is it also expected that $ref objects in other parts of the OAS document can use the canonical Id?

yes

This example uses the standard OAS way of referencing a component. However, it ignores the fact that $Id has been defined. I am guessing that this is still fine.

More or less. Technically, if the OpenAPI document were considered a JSON Schema, then the behavior is undefined. But particularly for landing directly on the schema object with an $id, I suspect in practice most implementations will support it. It was (or ambiguously appeared to be) required in the last few drafts.

Also, I think it would be fine if OAS had its own rules for things directly under /components/schemas. Although I guess that would actually be more complicated for tooling vendors.

Originally posted by @handrews in #1977 (comment)

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