Docs
Launch GraphOS Studio

Schema linter rules

Reference


This reference lists the rules that you can enforce with

, along with the code that returns for each rule violation.

Naming rules

These rules enforce naming conventions. Rules are categorized by the part(s) of your schema that they correspond to.

Fields

Types

These rules apply to all types that appear in a , including:

  • Objects
  • Interfaces
  • Inputs
  • Enums
  • Unions

Objects

Interfaces

Inputs and arguments

Enums

Directives

Composition rules
Since 2.4

rules flag potential improvements to

schemas used to
compose
a .

Inconsistent elements

These rules id inconsistencies in , types, , etc across . Such inconsistencies can disrupt or even break

.

Compatibility

In some cases, inconsistency rules also indicate the compatibility of checked types. Two types are compatible if one is a non-nullable version, a list version, a subtype, or a combination of any of these of the other.

For example, the price in the example below are inconsistent and incompatible because they use completely different types (Float vs String):

Subgraph A
type Product {
id: ID!
name: String
price: Float
}
Subgraph B
type Product {
id: ID!
name: String
price: String
}

These price in the example below are inconsistent but compatible since both use Floats, but one is nullable and the other is the non-nullable list of Floats.

Subgraph A
type Product {
id: ID!
name: String
price: Float
}
Subgraph B
type Product {
id: ID!
name: String
price: [Float]!
}

Overridden and unused elements

Directives

Other rules

These rules define conventions for the entire schema and usage outside of .

Schema

These rules apply to the entire schema.

Directives

Custom rules

The schema linter is

with the predefined rules documented above. Custom rule creation isn't currently supported but is under consideration.

Previous
Overview
Next
Overview
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company