Documentation

gomask validate

Validate YAML routine configuration against schema

gomask validate

Validate YAML routine configuration against the schema.

Synopsis

gomask validate YAML_FILE [OPTIONS]

Description

The validate command checks your YAML configuration file for:

  • Schema compliance: Ensures all required fields are present and correctly typed
  • Function validation: Verifies that referenced functions exist and parameters are valid
  • Connector validation: Checks that referenced connectors exist
  • Environment variables: Validates that all referenced env vars are defined
  • Logical consistency: Checks for issues like circular references or invalid hierarchy levels

Always run validate before import or run to catch configuration errors early.

Arguments

ArgumentRequiredDescription
YAML_FILEYesPath to the YAML configuration file to validate

Options

OptionTypeDefaultDescription
--env-file PATHpathnonePath to a .env file containing environment variables
--skip-validationflagfalseSkip schema validation (only parse YAML)
--detailed, -dflagfalseShow detailed error messages with suggestions
--quiet, -qflagfalseSuppress output, only return exit code
--show-configflagfalseDisplay the parsed configuration after validation
--param KEY=VALUEstringnoneOverride runtime parameters (can be specified multiple times)

Examples

Basic Validation

gomask validate routine.yaml

Output:

✓ Schema validation passed
✓ Functions validated (15 functions)
✓ Connector reference valid
✓ No circular dependencies

Validation successful!

Detailed Error Output

gomask validate routine.yaml --detailed

Output with errors:

✗ Validation failed

Errors:
  1. tables[0].columns[2].generation_function: Unknown function 'fake_emal'
     Did you mean: 'generate_email'?

  2. tables[1].hierarchy_level: Invalid value 0
     Parent table 'users' is at level 0, this table must be at level 1 or higher

  3. routine.connector_id: Connector with ID 99 not found
     Available connector IDs: 1, 2, 3

3 errors found

Validate with Environment Variables

gomask validate routine.yaml --env-file .env

Show Parsed Configuration

gomask validate routine.yaml --show-config

Output:

✓ Validation successful

Parsed Configuration:
─────────────────────
Name: Customer Data Generator
Type: synthetic
Connector ID: 1
Tables: 4
  - users (500 records)
  - orders (1000 records)
  - products (200 records)
  - order_items (2500 records)
Functions: 32

Override Parameters During Validation

gomask validate routine.yaml --param record_count=100 --param env=staging

Quiet Mode for CI/CD

gomask validate routine.yaml --quiet && echo "Valid" || echo "Invalid"

Validation Checks

Schema Validation

  • Required fields present (routine.name, routine.type, routine.connector_id, tables)
  • Correct data types for all fields
  • Valid enum values (e.g., routine.type must be synthetic or masking)

Function Validation

  • All referenced functions exist in the function library
  • Required parameters are provided
  • Parameter types match function expectations
  • No unknown parameters

Connector Validation

  • Referenced connector ID exists in the platform
  • Connector is accessible by your team
  • Connection is active and healthy

Hierarchy Validation

  • No circular foreign key references
  • Parent tables have lower hierarchy levels than child tables
  • Referenced tables are included in the routine

Environment Variable Validation

  • All ${VAR} references have values defined
  • Required variables (${VAR:?message}) are set
  • Default values are valid

Exit Codes

CodeDescription
0Validation passed
1Validation failed

Common Errors

Missing Required Field

Error: routine.name is required

Solution: Add the name field to your routine section.

Unknown Function

Error: Unknown function 'fake_emal' at tables[0].columns[2]

Solution: Check the function name for typos. Use gomask functions list to see available functions.

Invalid Hierarchy

Error: Table 'orders' references 'users' but has the same hierarchy level

Solution: Increase the hierarchy level of the child table.

Missing Environment Variable

Error: Environment variable 'DB_PASSWORD' is not set

Solution: Define the variable in your environment or provide an --env-file.

See Also