Skip to content

Do we have a way to query and return the root object? #390

Open
@gregsdennis

Description

@gregsdennis

For JSON Schema, I'm exploring Spectral which uses JSON Path to identify nodes that need rules applied to them.

I'm having trouble isolating the root object when type is object.

For example:

{
  "type": "object",
  "properties": {
    "bar": {
      "type": "object",
      "minimum": 5
    }
  },
  "minimum": 5
}

For this data, the path $..[?(@.type=='object')] returns only the node at /properties/bar. However, I want to also return the root object since it also contains type: object.

I don't think we have support for this, and it seems pretty crucial.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions