Skip to content

Field Paths #1215

@magicmark

Description

@magicmark

Response Position is defined in the spec to refer a position in the response.

Do we / should we have something to refer to a position in ExecutableDefinition (i.e. an operation or fragment)?

The proposed syntax is:

Example

fragment FooFields on Foo {
  bar # field path is `bar`

  aliasedBar: bar # field path is `aliasedBar`

  baz {
    qux # field path is `baz.qux`
  }
}

(array indicators are not part of a Field Path since this information isn't encoded in an operation/fragment definition)

I suspect this might already be used in some places? Curious if anyone has prior art in existing tooling that might uncover any edge cases.

Motivation

Being able to refer a "field path" (without having to first define what a "field path" is would be useful in graphql/gaps#10: (https://github.com/graphql/gaps/pull/10/changes#r2986114701)

Additionally, I could maybe see this being useful in linter tools and such?

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