Skip to main content

Checks

Checks Configuration.

Sample Config

kind: Checks
name: service-name
spec:
steps:
operational:
fail_on: warning
linting:
fail_on: error
disable: false
schema_lint_rules:
- level: error
disable: true
name: FIELD_NAMES_CAMEL_CASE
- level: warning
name: REST_FIELD_NAMES

Spec

This section defines the format of Inigo's Checks type configuration files. Fields marked as required must be specified if the parent is defined.

FieldTypeDescription
stepsCheckStepsSteps configuration.

CheckSteps

FieldTypeDescription
operationalOperationalStepOperational step configuration.
lintingLintingStepLinting step configuration.
compositionCompositionStep

OperationalStep

FieldTypeDescription
fail_onstring default:warningFailure level. You can specify the level of the message that will cause the step to fail.
One of:
- undefined
- debug
- info
- warning
- error
time_rangestring default:"30d"Provide a time range to use for breaking changes detection. For example: 1h, 10d, 1m. 0 means that check against analytics is disabled, 30d - max.

String represents the duration in the form "72h3m0.5s".

LintingStep

FieldTypeDescription
fail_onstring default:errorFailure level. You can specify the level of the message that will cause the step to fail.
One of:
- undefined
- debug
- info
- warning
- error
disablebooleanEnable or disable linter.
schema_lint_rules[LintSchemaRule]

LintSchemaRule

FieldTypeDescription
namestring required
levelstring required default:undefinedOne of:
- undefined
- debug
- info
- warning
- error
disableboolean

CompositionStep

FieldTypeDescription
auto_publishboolean default:true

Schema Linting Fine Tuning

To fine tune some schema specific fields,types, etc. or just to skip linting of some of the schema part there is a lint directive. Directive definition looks like this:

directive @lint(
ignore: [String!]
except: [String!]
) on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

ignore parameter exists to define the list of the rules that are required to be skipped if fail on the defined place. To ignore all the rules for something you can place lint directive without params or with empty ignore list, like this:

type Book @lint {
title: String!
}

type TypeBook @lint(ignore: []) {
title: String!
}

Ignore some of the rules example:

type TypeBook @lint(ignore: ["INPUT_TYPE_SUFFIX", "ENUM_INPUT_SUFFIX"]) {
title: String!
}

except parameter exists to define the list of the rules NOT to ignore and skip failing the step. It might be useful to ignore all the rules for a particular place but except some specific set rules. Following example will skip failing on linter step for all the configured rules except of the "INPUT_TYPE_SUFFIX" and "ENUM_INPUT_SUFFIX":

type TypeBook @lint(except: ["INPUT_TYPE_SUFFIX", "ENUM_INPUT_SUFFIX"]) {
title: String!
}

Available Linter Rules

Rule NameDescription
FIELD_NAMES_CAMEL_CASEField names should use only camelCase.
INPUT_FIELD_NAMES_CAMEL_CASEInput field names should use only camelCase.
REST_FIELD_NAMESRequire field's name never to start from REST semantics verbs: get, list, post, put, patch.
OBJECT_REQUIRE_IDRequire object types to have a field id: ID!.
TYPE_NAMES_PASCAL_CASEEvery Objects, Interfaces, Inputs, Enums, Unions type names should use PascalCase.
TYPE_PREFIXDon't use the prefix Type in Objects, Interfaces, Inputs, Enums, Unions type's name.
TYPE_SUFFIXDon't use the suffix Type in Objects, Interfaces, Inputs, Enums, Unions type's name.
OBJECT_PREFIXDon't use the prefix Object in object type's name.
OBJECT_SUFFIXDon't use the suffix Object in object type's name.
INTERFACE_PREFIXDon't use the prefix Interface in interface type's name.
INTERFACE_SUFFIXDon't use the suffix Interface in interface type's name.
INPUT_TYPE_SUFFIXAlways use suffix Input in input type's name.
ENUM_VALUES_SCREAMING_SNAKE_CASEEnum values should use only SCREAMING_SNAKE_CASE.
ENUM_PREFIXDon't use the prefix Enum in enum type's name.
ENUM_SUFFIXDon't use the suffix Enum in enum type's name.
ENUM_INPUT_SUFFIXRequire enum type input argument to use the suffix Input in its name.
ENUM_OUTPUT_SUFFIXRequire enum return type of a non-input field not to use the suffix Input.
DIRECTIVE_NAMES_CAMEL_CASERequire camelCase for directive names.
ELEMENTS_DESCRIPTIONRequire all elements in the schema to have description.
DEPRECATED_DIRECTIVE_REASONRequire @deprecated directive to have reason argument.
EVERY_TYPE_IS_REACHABLEEach definition should be reachable.
TYPE_SIMILARITYDon't define similar types in the schema.

FIELD_NAMES_CAMEL_CASE

Field names should use only camelCase.

type Actor {
FirstName: String! # PascalCase
}

type Actor {
firstName: String # camelCase
}

INPUT_FIELD_NAMES_CAMEL_CASE

Input field names should use only camelCase.

input Actor {
FirstName: String! # PascalCase
}

input Actor {
firstName: String # camelCase
}

REST_FIELD_NAMES

Require field's name never to start from REST semantics verbs: get, list, post, put, patch.

type Query {
getFilms: [Film!]!
}

type Query {
films: [Film!]!
}

OBJECT_REQUIRE_ID

Require object types to have a field id: ID!.

type User {
name: String!
}

type User {
id: ID!
name: String!
}

TYPE_NAMES_PASCAL_CASE

Every Objects, Interfaces, Inputs, Enums, Unions type names should use PascalCase.

type parentOrganization { # camelCase
id: ID!
}

type ParentOrganization { # PascalCase
id: ID!
}

TYPE_PREFIX

Don't use the prefix Type in Objects, Interfaces, Inputs, Enums, Unions type's name.

type TypeBook {
title: String!
}

type Book {
title: String!
}

TYPE_SUFFIX

Don't use the suffix Type in Objects, Interfaces, Inputs, Enums, Unions type's name.

type BookType {
title: String!
}

type Book {
title: String!
}

OBJECT_PREFIX

Don't use the prefix Object in object type's name.

type ObjectBook {
title: String!
}

type Book {
title: String!
}

OBJECT_SUFFIX

Don't use the suffix Object in object type's name.

type BookObject {
title: String!
}

type Book {
title: String!
}

INTERFACE_PREFIX

Don't use the prefix Interface in interface type's name.

interface InterfaceBook {
title: String
author: String
}

interface Book {
title: String
author: String
}

INTERFACE_SUFFIX

Don't use the suffix Interface in interface type's name.

interface BookInterface {
title: String
author: String
}

interface Book {
title: String
author: String
}

INPUT_TYPE_SUFFIX

Always use suffix Input in input type's name.

input TweetDetails {
title: String!
content: String!
}

input TweetDetailsInput {
title: String!
content: String!
}

ENUM_VALUES_SCREAMING_SNAKE_CASE

Enum values should use only SCREAMING_SNAKE_CASE.

enum Location {
public_park # snake_case
}

enum Location {
PUBLIC_PARK # SCREAMING_SNAKE_CASE 😱
}

ENUM_PREFIX

Don't use the prefix Enum in enum type's name.

enum EnumGenres {
HOUSE
RNB
TRANCE
}

enum Genres {
HOUSE
RNB
TRANCE
}

ENUM_SUFFIX

Don't use the suffix Enum in enum type's name.

enum GenresEnum {
HOUSE
RNB
TRANCE
}

enum Genres {
HOUSE
RNB
TRANCE
}

ENUM_INPUT_SUFFIX

Require enum type input argument to use the suffix Input in its name.

enum Role {
OWNER
VIEWER
}

type Query {
users(role: Role): [User!]!
}

enum RoleInput {
OWNER
VIEWER
}

type Query {
users(role: RoleInput): [User!]!
}

ENUM_OUTPUT_SUFFIX

Require enum return type of non-input field not to use the suffix Input.

enum CrewRoleInput {
EDITOR
VIEWER
}

type Query {
crewRole(crewId: ID!): CrewRoleInput
}

enum CrewRole {
EDITOR
VIEWER
}

type Query {
crewRole(crewId: ID!): CrewRole
}

DIRECTIVE_NAMES_CAMEL_CASE

Require camelCase for directive names.

directive @SomeField on FIELD_DEFINITION # PascalCase

directive @someField on FIELD_DEFINITION # camelCase

ELEMENTS_DESCRIPTION

Require all elements in the schema to have description.

type Actor {
username: String!
}

"Represents an actor"
type Actor {
"The actor's username"
username: String!
}

DEPRECATED_DIRECTIVE_REASON

Require @deprecated directive to have reason argument.

type Film {
title: String!
name: String @deprecated
}

type Film {
title: String!
name: String @deprecated(reason: "Use Film.title instead")
}

EVERY_TYPE_IS_REACHABLE

Each definition should be reachable.

type Film {
title: String!
}

type Query {
films: [Film!]!
}

type Film {
title: String!
}

TYPE_SIMILARITY

Don't define similar types in the schema.

type Actor {
name: String!
}

type Film {
title: String!
actors: [Actor!]!
}

type Movie {
title: String!
actors: [Actor!]!
}

type Actor {
name: String!
}

type Film {
title: String!
actors: [Actor!]!
}