Skip to content

Configuration Schema Commands

The doover config-schema command group provides tools for managing application configuration schemas. These commands help you export configuration from your application code, validate schemas, and generate sample configurations.

Available Commands

CommandDescription
exportExport application configuration to JSON
validateValidate JSON schema
generateGenerate sample configuration from schema

Exporting Configuration

The doover config-schema export command exports your application's configuration schema to the doover_config.json file.

Usage

doover config-schema export [APP_PATH] [OPTIONS]

Arguments and Options

Argument/OptionDescriptionDefault
APP_PATHPath to the application directoryCurrent directory
--validate/--no-validateValidate configuration after export--validate
--config-fpCustom path for the output config filedoover_config.json

Example

# Export configuration in current directory
doover config-schema export

# Export from specific directory
doover config-schema export ./my-app

# Export without validation
doover config-schema export --no-validate

# Export to custom path
doover config-schema export --config-fp ./custom-config.json

How It Works

  1. The command runs your application's app_config.py script using uv
  2. The script generates the configuration schema from your Python config classes
  3. The schema is written to doover_config.json
  4. If validation is enabled, the schema is checked for correctness

Application Configuration Script

Your application should have an app_config.py file (or export-config script) that defines the configuration schema:

# src/my_app/app_config.py
from pydoover.app import AppConfig

class MyAppConfig(AppConfig):
    temperature_threshold: float = 25.0
    polling_interval: int = 60
    alerts_enabled: bool = True

if __name__ == "__main__":
    MyAppConfig.export()

Validating Configuration

The doover config-schema validate command validates that your configuration schema is a valid JSON Schema.

Usage

doover config-schema validate [APP_PATH] [OPTIONS]

Arguments and Options

Argument/OptionDescriptionDefault
APP_PATHPath to the application directoryCurrent directory
--export/--no-exportExport configuration before validating--export

Example

# Validate configuration (exports first by default)
doover config-schema validate

# Validate from specific directory
doover config-schema validate ./my-app

# Validate without re-exporting
doover config-schema validate --no-export

Output

Successful validation:

Schema for my_app is valid.

Failed validation shows the JSON Schema error:

Failed to export application configuration: 'type' is a required property
...

What Gets Validated

The command:

  1. Reads the doover_config.json file
  2. Finds all entries with a config_schema field
  3. Validates each schema using jsonschema
  4. Reports success or failure for each schema

Generating Sample Configuration

The doover config-schema generate command creates a sample configuration based on your schema, using default values and examples.

Usage

doover config-schema generate [OUTPUT_PATH] [APP_PATH] [OPTIONS]

Arguments and Options

Argument/OptionDescriptionDefault
OUTPUT_PATHPath to write the sample configstdout
APP_PATHPath to the application directoryCurrent directory
--export/--no-exportExport configuration before generating--export

Example

# Generate sample config to stdout
doover config-schema generate

# Generate and save to file
doover config-schema generate ./sample-config.json

# Generate without re-exporting
doover config-schema generate --no-export

Output

The generated configuration uses:

  • Default values specified in the schema
  • Example values where provided
  • Generated sample values for required fields without defaults

Example output:

{
    "temperature_threshold": 25.0,
    "polling_interval": 60,
    "alerts_enabled": true,
    "notification_email": "user@example.com"
}

Using JSF

The command uses the JSF (JSON Schema Faker) library to generate realistic sample data from your schema.

Configuration Schema Format

The doover_config.json file contains application metadata and configuration schemas:

{
  "my_app": {
    "name": "my_app",
    "display_name": "My Application",
    "description": "Application description",
    "type": "DEV",
    "image_name": "ghcr.io/getdoover/my-app:main",
    "owner_org_key": "my-org",
    "config_schema": {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "properties": {
        "temperature_threshold": {
          "type": "number",
          "default": 25.0,
          "description": "Temperature threshold for alerts"
        },
        "polling_interval": {
          "type": "integer",
          "default": 60,
          "minimum": 1,
          "description": "Polling interval in seconds"
        },
        "alerts_enabled": {
          "type": "boolean",
          "default": true,
          "description": "Enable alert notifications"
        }
      },
      "required": ["temperature_threshold"]
    }
  }
}

JSON Schema Best Practices

Use Defaults

Provide sensible defaults for optional fields:

{
  "properties": {
    "timeout": {
      "type": "integer",
      "default": 30,
      "description": "Request timeout in seconds"
    }
  }
}

Add Descriptions

Document each field:

{
  "properties": {
    "api_key": {
      "type": "string",
      "description": "API key for external service authentication"
    }
  }
}

Use Constraints

Add validation constraints:

{
  "properties": {
    "port": {
      "type": "integer",
      "minimum": 1,
      "maximum": 65535,
      "default": 8080
    },
    "log_level": {
      "type": "string",
      "enum": ["debug", "info", "warning", "error"],
      "default": "info"
    }
  }
}

Provide Examples

Include examples for complex fields:

{
  "properties": {
    "schedule": {
      "type": "string",
      "description": "Cron expression for scheduling",
      "examples": ["0 * * * *", "0 0 * * *"]
    }
  }
}

Integration with Publishing

The doover app publish command automatically exports and validates the configuration schema before deploying:

doover app publish

Output:

Exporting application configuration...
Validating application configuration...
Schema for my_app is valid.
Exported application configuration.
Updating application on doover site...

To skip this step:

doover app publish --no-export-config

Troubleshooting

Schema Validation Errors

If validation fails, common issues include:

ErrorCauseSolution
'type' is a required propertyMissing type in propertyAdd "type": "string" etc.
'properties' is not validInvalid schema structureCheck JSON syntax
Additional properties not allowedExtra fields in schemaRemove unexpected fields

Export Failures

If export fails:

  1. Verify app_config.py exists and is executable
  2. Check that uv is installed and available
  3. Run the script directly to see errors:
    cd src/my_app && uv run app_config.py
    

Missing doover_config.json

If the file doesn't exist:

doover config-schema export

Or create it manually:

{
  "my_app": {
    "name": "my_app",
    "config_schema": {}
  }
}

Workflow Example

A typical configuration workflow:

# 1. Edit your app_config.py with new fields
# ...

# 2. Export the updated configuration
doover config-schema export

# 3. Validate the schema
doover config-schema validate --no-export

# 4. Generate a sample config for testing
doover config-schema generate ./test-config.json

# 5. Review and adjust as needed
# ...

# 6. Publish the application with the updated schema
doover app publish