CLIKontract
How to
Validate contract schemas
Check configured schema sources before generation.
What changes
validate reads Kontract source configuration, verifies selected schema sources, and runs each configured NestJS generator's compatibility preflight without writing generated files. It is the safe check before regenerating contracts or reviewing spec changes.
When this helps
- An API schema, async schema, or shared schema source changed.
- Generated output failed and you need to prove the schema source is valid first.
- CI needs to validate schemas without writing generated files.
Run this command
sumr kontract validate# all sourcessumr kontract validate --source platform# one sourcesumr kontract validate --target api-nestjs# schemas for targetFlags you can use
--source <name>Validate only one configured source.
--target <name>Validate only schemas needed by one configured target.
--max-concurrent <n>Limit how many validators run in parallel.
-c, --concurrency <n>Alias for --max-concurrent.
--verboseShow passing files as well as failures.
--quietSuppress all output except errors.
--help, -hShow the command syntax, supported flags, and examples without changing files.
Keep in mind
- Validate before generate when schemas changed.
- Kontract expands authoring-only
kontract.sets/$setsbefore validation and generation. - For TypeScript OpenAPI targets,
audiences.excludeis validated once against the complete selected source/target universe, not each generated service. A sibling service with no matching audience remains normal; a token absent from the whole source fails validation. - Configured NestJS targets run their write-free generator preflight during validation, so incompatible response envelopes, error projections, and required boundary schemas fail before output is written.
- Use scoped validation when reviewing a small schema change in a large repo.