graphql-spec icon indicating copy to clipboard operation
graphql-spec copied to clipboard

Standardize naming for "Schema Coordinates" (e.g. `Foo.bar`)

Open magicmark opened this issue 5 years ago • 7 comments

Update: RFC PR is here! https://github.com/graphql/graphql-spec/pull/746


For example, given this schema:

type Business {
    reviews: [Reviews]
    name: String
}

type Review {
    body: String
    ...
}
  • Business.name uniquely identifies the "name" field on the "Business" type
  • Business.reviews uniquely identifies the "reviews" field on the "Business" type
  • Review.body uniquely identifies the "body" field on the "Review" type

We intuitively understand what this dot separated string means, but I can't find anything anywhere that formalizes its definition, or what it's even called.

~I'll go with "type/field pair" for now since I vaguely remember seeing that somewhere (but can't remember where)~

Why do we want this?

Various tooling wants to show field coordinates - usually for documentation or metrics/tracking purposes.

Examples:

  • GraphiQL's documentation tab search bar showing field coordinates to uniquely identify fields:

  • GraphQL Inspector (840 stars) displays field coordinates in its output:

  • And internally at Yelp, we want to show a list of "most popular fields in the schema" - using field coordinates is a good way to track this!

The ask

Being able to communicate what this strange dot separated string means would be useful to folks onboarding, and it'd be great to standardize this and point to something in the spec/official docs.

Does this worth standardizing and including in the docs?

Thanks!

magicmark avatar Jun 15 '20 18:06 magicmark