-
Notifications
You must be signed in to change notification settings - Fork 37
ContainerValidation
Mauro Gadaleta edited this page Jun 17, 2026
·
2 revisions
The container can validate service wiring before runtime to detect dependency graph issues early.
const result = await container.compile({
validate: true,
throwOnError: false
})
console.log(result.isValid)
console.log(result.errors)
console.log(result.warnings)
console.log(result.info)By default, when validate: true and throwOnError is not false, compile throws ContainerValidationError if validation errors exist.
await container.compile({ validate: true })- Missing dependency
- Circular dependency
- Unresolved parameters (
%param%)
- Unused nullable references (
@?service) when target always exists - Deprecated service used by non-deprecated services
- Tagged services without any tag consumer
- Keyed tag groups with multiple services and no
default: true
ndi container:validate [options] <path>Options:
-
--format <format>:textorjson -
--strict: exit with code1when warnings are present
Examples:
ndi container:validate ./config/services.yaml
ndi container:validate --format=json ./config/services.yaml
ndi container:validate --strict ./config/services.yaml- Without
validate: true, compile behaves as before. - With
throwOnError: false, compile returns the full validation report instead of throwing.
Copyright © 2023-2024 Mauro Gadaleta