Docs
Launch GraphOS Studio

Schema linter rules

Reference


This reference lists the rules that you can enforce with GraphOS schema linting, 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

Composition rules flag potential improvements to subgraph schemas used to compose a .

Inconsistent elements

These rules identity inconsistencies in , types, arguments, etc across . Such inconsistencies can disrupt or even break composition.

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 fields in the example subgraphs 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 fields in the example subgraphs 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 directive usage outside of composition.

Schema

These rules apply to the entire schema.

Directives

Custom rules

The schema linter is configurable 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