Introduction
Schema linting helps find mistakes in your GraphQL schema before using it. It keeps your schema clean and easy to understand.
Jump into concepts and practice - no test required
Use a schema linting tool or command like:
graphql-schema-linter --schema schema.graphql
Or configure linting rules in a config file like .graphqlconfig or .eslintrc.ymlgraphql-schema-linter --schema schema.graphql
rules: - no-unused-types - no-anonymous-operations - unique-field-definition
# schema.graphql
type Query {
hello: String
user(id: ID!): User
}
type User {
id: ID!
name: String
}
# Run linting command:
graphql-schema-linter --schema schema.graphqlschema linting in GraphQL?{
"no-deprecated-fields": true,
"require-description": true
}Field 'userAge' is missing a description. Which fix will resolve this error?