Linter rulesGraphQLcustom-scalar-specified-by

custom-scalar-specified-by

Since 0.9.0

This rule checks that custom scalars link their specification with @specifiedBy.

Rule Details

A custom scalar is a contract between the server and its clients; the URL of its specification tells clients how to parse and serialize it.

Configuration

This rule has no options.

version: "1.0"
commands:
  lint:
    graphql:
      rules:
        custom-scalar-specified-by: warning

The rule can be disabled for a node and everything nested in it with an # apigenie-lint-disable custom-scalar-specified-by comment on the node, or for a whole file with the comment at the top of the file, separated from the first definition by a blank line. It applies to definitions.

Examples

Good.

scalar DateTime @specifiedBy(url: "https://www.rfc-editor.org/rfc/rfc3339")

Bad. The linter reports Scalar type 'DateTime' should link its specification with @specifiedBy(url:).

scalar DateTime

Further reading