By default, kongctl lint checks each input as written, including template
definitions. Use --expand to lint values from local !file includes,
principal !csv inputs, and _templates and _extends inheritance. Rules can
then check included and inherited values after resource overrides apply.
For example, save a shared API template in templates.yaml:
_templates:
documented-api:
description: Create and track tasks
Use the template in kong.yaml:
apis:
- _extends: documented-api
ref: tasks-api
name: Task API
Lint both files with the ruleset.yaml file from the kongctl lint example:
kongctl lint -f templates.yaml -f kong.yaml -r ruleset.yaml --expand
The API passes the rule because its expanded configuration contains the
inherited description. Without --expand, the rule reports a missing
description on the API.
All selected inputs share template definitions, so include both the template
files and the files that use them. Each input is linted separately after
expansion; rules can’t detect duplicates across files. Empty inputs, including
files that only define templates, are skipped. Templates are checked where
they’re used. The command fails if nothing remains to lint.
For more information, see reusable configuration templates.
With --expand, you can pass YAML files (.yaml or .yml), directories, or
standard input (-f -). Use -R to search subdirectories. URL inputs aren’t
supported. Each selected input must contain one YAML document; split documents
separated by --- into separate files.
!file paths resolve relative to the file containing the tag, including tags
inherited through templates. Includes must stay within the source root:
- For a file input, the root is its parent directory.
- For a directory input, the root is that directory.
- For standard input, the root is the working directory, which also resolves
relative include paths.
Included fragments are checked as part of the file that includes them. A
fragment also selected as an input is checked independently, including lists
and scalars. Keep fragments outside selected inputs to avoid independent
checks. The vacuum linter may report index-failure for standalone scalars.
!env (including store: true), !ref, !secret, and lookup tags remain
unresolved placeholders. Expansion doesn’t read environment values, fetch
secrets, or contact Konnect. Rules that expect concrete values must account for
these placeholders. Existing OpenAPI $ref resolution and ruleset inheritance
can still access the network.
Expansion checks YAML, tag, and template syntax. It doesn’t apply defaults,
validate resource schemas, or check the types of fields containing !env.
Passing lint doesn’t establish that configuration is ready to apply. Use
kongctl plan for that validation.
Findings identify the input filename, but line and column numbers refer to the
expanded content held in memory. They may differ from the original source
locations. Text findings append (expanded) to the message; JSON and YAML
findings include expanded: true. Expanded content isn’t saved to disk.
Expansion errors fail the command and identify the source; template errors also
report a position.