gb validate
Validate Genbox configuration files.
Synopsis
gb validate [options]Description
Checks your configuration for errors, warnings, and potential issues before creating environments. Validates schema, $detect resolution, connections, and environment references.
Options
| Option | Description |
|---|---|
--profile <name> | Validate with specific profile |
--strict | Treat warnings as errors |
--fix | Attempt to fix simple issues |
Examples
Basic Validation
gb validateWith Profile
gb validate --profile full-stackStrict Mode
gb validate --strictValidation Output
Successful Validation
Validating configuration...
Schema validation:
β Version 4.0 valid
β Project structure valid
β All required fields present
$detect resolution:
β apps.web.port β 3000
β apps.web.framework β nextjs
β apps.api.port β 3050
Connection validation:
β web β api (NEXT_PUBLIC_API_URL)
β api β mongodb (MONGODB_URI)
β api β redis (REDIS_URL)
Environment references:
β staging.mongodb.url resolved
β staging.api.url resolved
βββββββββββββββββββββββββββββββββββββββββββββββ
Result: β Configuration valid
Ready to create environments!Validation with Errors
Validating configuration...
Schema validation:
β Version 4.0 valid
β apps.admin.port: required field missing
$detect resolution:
β apps.web.port β 3000
β apps.admin.port: could not detect
Tried: package.json scripts.dev (no --port flag found)
Suggestions:
β’ Add explicit value: port: 3001
β’ Add --port flag to scripts.dev in admin/package.json
β’ Check detected.yaml for available values
Connection validation:
β web β api (NEXT_PUBLIC_API_URL)
β api β elasticsearch: 'elasticsearch' not defined
If api needs elasticsearch, add to provides:
provides:
elasticsearch:
type: search
image: elasticsearch:8
port: 9200
Environment references:
β staging.mongodb.url contains ${STAGING_MONGODB_URL}
STAGING_MONGODB_URL not found in .env.genbox
This will fail at runtime unless the variable is set.
βββββββββββββββββββββββββββββββββββββββββββββββ
Result: 2 errors, 1 warning
Fix errors before running 'gb create'.Validation Categories
Schema Validation
- Required fields present
- Valid field types
- Valid enum values
- Proper structure
$detect Resolution
- All markers can be resolved
- Detected values available
- No circular references
Connection Validation
- Referenced services exist
- Connection modes valid
- No orphaned connections
Environment References
- Environment variables exist
- URLs properly formatted
- Source environments defined
Fix Mode
gb validate --fixAttempts to fix simple issues:
- Add missing optional fields with defaults
- Correct common typos
- Format YAML properly
Notes
- Run before
gb createto catch issues early - Use
--strictin CI/CD pipelines - Errors must be fixed; warnings are informational
--fixonly handles simple issues
See Also
gb resolve- Compute final configgb config- Inspect configurationgb init- Generate configuration
Last updated on