Skip to content

Clarification on Reference/Schema #552

@char0n

Description

@char0n

Hi everybody,

I'm working on AsyncApi 2.0.0 tooling and I'm seeking a verification of my understanding of the spec regarding Reference/Schema Objects.

Let's say I have following Schema Object definition somewhere inside AsyncApi 2.0.0 document.

{
  "type": "object",
  "oneOf": [
    { "$ref": "#/components/schemas/Schema1" }
   ]  
}

Semantics of this fragments are going to be following:

(SchemaObject
  (FixedField
    (String)
    (String))
  (FixedField
    (String)
    (Array
      (ReferenceObject))))   
)

When constructing semantics I've used the following sentence from the spec:

Alternatively, any time a Schema Object can be used, a Reference Object can be used in its place. This allows referencing definitions in place of defining them inline.

I understand it in the sense that whenever the SchemaObject is intercepted and that SchemaObject only contains $ref propertly, it is understood as ReferenceObject. JSON Reference spec is applied for dereferencing the Reference Objects. This also effectively means that $id on SchemaObject can be defined, but virtually have no semantics and is not used for dereferencing at all.

Am I correct in my understanding and assumptions?

Thanks a lot!

PS: just a suggestion, maybe enabling Discussions on this repo would be beneficial so that questions are directed there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ❔ QuestionA question about the spec or processes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions