Skip to content

Question about references ($ref) #1508

Closed
@shonigbaum

Description

@shonigbaum

Hello together,

I have a small question about references. I’m currently in a discussion with a library owner whether the provided $ref is valid or invalid.

Given is the following schema:

{
  "$id": "schemaA/1.0",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "fee": {
      "type": "object",
      "properties": {
        "modificationFee": {
          "$ref": "#/properties/purchaseRate/allOf/0"
        }
      }
    },
    "purchaseRate": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "amount": {
              "type": "number",
              "format": "float"
            }
          }
        },
        {
          "type": "object",
          "$ref": "#/properties/fee/properties/modificationFee/properties/amount"
        }
      ]
    }
  }
}

Question:
Is the $ref to #/properties/fee/properties/modificationFee/properties/amount a valid $ref?

The first part points to #/properties/fee/properties/modificationFee, which contains a second $ref to #/properties/purchaseRate/allOf/0. And the second part /properties/amount relates on this second $ref.

It appears incorrect to me. Is there a section in the specifications that addresses this topic? I couldn’t find anything related.

Thanks in advance.

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