custom-scalar-specified-by

Since 0.9.0 · In the rulesets: Strict at error, All at error

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.

The rule applies to definitions. An # apigenie-lint-disable custom-scalar-specified-by comment on a node turns it off for the node and everything nested in it; at the top of the file, separated from the first definition by a blank line, the comment turns it off for the whole file.

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

Turn it off or change its severity

In apigenie.yaml, off turns the rule off and warning or error sets its severity; a rule with options takes the severity and the options as a pair, [warning, options]. lint.graphql has the details.

commands:
  lint:
    graphql:
      rules:
        custom-scalar-specified-by: off

Further reading

Was this helpful?