mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
- Updated default schema version from 1.0.0 to 2.0.0 in config_schema.json, events_schema.json, forms_schema.json, jobs_schema.json, migrations_schema.json, and permissions_schema.json. - Introduced storybook-common-definitions.json to centralize common definitions for storybook context and controls. - Refactored storybook_schema.json to reference common definitions instead of duplicating schema properties. - Enhanced test scripts for schema validation to ensure comprehensive coverage and improved error reporting.
449 lines
13 KiB
JSON
449 lines
13 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"$id": "https://metabuilder.dev/schemas/config.schema.json",
|
|
"title": "Configuration Schema",
|
|
"description": "Configuration and environment variable definitions for MetaBuilder packages",
|
|
"type": "object",
|
|
"required": ["schemaVersion", "package"],
|
|
"properties": {
|
|
"$schema": {
|
|
"type": "string",
|
|
"description": "JSON Schema reference"
|
|
},
|
|
"schemaVersion": {
|
|
"type": "string",
|
|
"description": "Schema version",
|
|
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
"default": "2.0.0"
|
|
},
|
|
"package": {
|
|
"type": "string",
|
|
"description": "Package identifier"
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "Configuration description"
|
|
},
|
|
"environments": {
|
|
"type": "array",
|
|
"description": "Supported environments",
|
|
"items": {
|
|
"type": "string",
|
|
"enum": ["development", "test", "staging", "production", "local"]
|
|
},
|
|
"default": ["development", "production"]
|
|
},
|
|
"variables": {
|
|
"type": "array",
|
|
"description": "Configuration variable definitions",
|
|
"items": {
|
|
"$ref": "#/definitions/variable"
|
|
}
|
|
},
|
|
"featureFlags": {
|
|
"type": "array",
|
|
"description": "Feature flag definitions",
|
|
"items": {
|
|
"$ref": "#/definitions/featureFlag"
|
|
}
|
|
},
|
|
"secrets": {
|
|
"type": "array",
|
|
"description": "Secret/sensitive configuration",
|
|
"items": {
|
|
"$ref": "#/definitions/secret"
|
|
}
|
|
},
|
|
"providers": {
|
|
"type": "array",
|
|
"description": "Configuration providers (sources)",
|
|
"items": {
|
|
"$ref": "#/definitions/provider"
|
|
}
|
|
},
|
|
"validation": {
|
|
"$ref": "#/definitions/validationConfig"
|
|
}
|
|
},
|
|
"definitions": {
|
|
"variable": {
|
|
"type": "object",
|
|
"required": ["name", "type"],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Variable name (UPPER_SNAKE_CASE recommended)",
|
|
"pattern": "^[A-Z][A-Z0-9_]*$"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"description": "Variable type",
|
|
"enum": ["string", "number", "boolean", "json", "url", "email", "path", "enum"]
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "Variable description"
|
|
},
|
|
"required": {
|
|
"type": "boolean",
|
|
"description": "Whether variable is required",
|
|
"default": false
|
|
},
|
|
"default": {
|
|
"description": "Default value"
|
|
},
|
|
"enum": {
|
|
"type": "array",
|
|
"description": "Allowed values (for enum type)",
|
|
"items": { "type": "string" }
|
|
},
|
|
"pattern": {
|
|
"type": "string",
|
|
"description": "Regex pattern for validation"
|
|
},
|
|
"min": {
|
|
"type": "number",
|
|
"description": "Minimum value (for number type)"
|
|
},
|
|
"max": {
|
|
"type": "number",
|
|
"description": "Maximum value (for number type)"
|
|
},
|
|
"minLength": {
|
|
"type": "integer",
|
|
"description": "Minimum length (for string type)"
|
|
},
|
|
"maxLength": {
|
|
"type": "integer",
|
|
"description": "Maximum length (for string type)"
|
|
},
|
|
"environment": {
|
|
"type": "array",
|
|
"description": "Environments where this variable applies",
|
|
"items": { "type": "string" }
|
|
},
|
|
"envVar": {
|
|
"type": "string",
|
|
"description": "Environment variable name (if different from name)"
|
|
},
|
|
"sensitive": {
|
|
"type": "boolean",
|
|
"description": "Whether this is sensitive data (mask in logs)",
|
|
"default": false
|
|
},
|
|
"deprecated": {
|
|
"oneOf": [
|
|
{ "type": "boolean" },
|
|
{
|
|
"type": "object",
|
|
"properties": {
|
|
"since": { "type": "string" },
|
|
"reason": { "type": "string" },
|
|
"replacement": { "type": "string" }
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"transformer": {
|
|
"type": "string",
|
|
"description": "Function to transform/parse the value"
|
|
},
|
|
"validator": {
|
|
"type": "string",
|
|
"description": "Custom validator function reference"
|
|
},
|
|
"example": {
|
|
"description": "Example value"
|
|
}
|
|
}
|
|
},
|
|
"featureFlag": {
|
|
"type": "object",
|
|
"required": ["name"],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Feature flag name",
|
|
"pattern": "^[a-z][a-z0-9_-]*$"
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "Feature description"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"description": "Default enabled state",
|
|
"default": false
|
|
},
|
|
"environments": {
|
|
"type": "object",
|
|
"description": "Environment-specific settings",
|
|
"additionalProperties": {
|
|
"type": "object",
|
|
"properties": {
|
|
"enabled": { "type": "boolean" },
|
|
"rollout": {
|
|
"type": "object",
|
|
"properties": {
|
|
"percentage": {
|
|
"type": "number",
|
|
"minimum": 0,
|
|
"maximum": 100,
|
|
"description": "Percentage of users to enable for"
|
|
},
|
|
"users": {
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"description": "Specific user IDs to enable for"
|
|
},
|
|
"groups": {
|
|
"type": "array",
|
|
"items": { "type": "string" },
|
|
"description": "User groups to enable for"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"rules": {
|
|
"type": "array",
|
|
"description": "Conditional rules for enabling",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"condition": {
|
|
"type": "string",
|
|
"description": "Condition expression or function reference"
|
|
},
|
|
"enabled": {
|
|
"type": "boolean"
|
|
},
|
|
"description": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"variants": {
|
|
"type": "array",
|
|
"description": "Feature variants for A/B testing",
|
|
"items": {
|
|
"type": "object",
|
|
"properties": {
|
|
"name": { "type": "string" },
|
|
"weight": {
|
|
"type": "number",
|
|
"minimum": 0,
|
|
"maximum": 100
|
|
},
|
|
"config": {
|
|
"type": "object",
|
|
"additionalProperties": true
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"dependencies": {
|
|
"type": "array",
|
|
"description": "Other feature flags this depends on",
|
|
"items": { "type": "string" }
|
|
},
|
|
"tags": {
|
|
"type": "array",
|
|
"description": "Tags for organization",
|
|
"items": { "type": "string" }
|
|
},
|
|
"owner": {
|
|
"type": "string",
|
|
"description": "Feature owner/team"
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"expiresAt": {
|
|
"type": "string",
|
|
"format": "date-time",
|
|
"description": "When to automatically disable/remove flag"
|
|
}
|
|
}
|
|
},
|
|
"secret": {
|
|
"type": "object",
|
|
"required": ["name"],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Secret name",
|
|
"pattern": "^[A-Z][A-Z0-9_]*$"
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": "Secret description"
|
|
},
|
|
"provider": {
|
|
"type": "string",
|
|
"description": "Secret provider/vault. PRODUCTION: Use managed vaults (aws-secrets-manager, azure-key-vault, hashicorp-vault, gcp-secret-manager) for secure secret storage with rotation and access control. DEVELOPMENT: env/file are acceptable for local development but should NEVER be used in production. SECURITY: Secrets in env vars or files can be exposed in logs, process listings, or source control.",
|
|
"enum": ["env", "file", "aws-secrets-manager", "azure-key-vault", "hashicorp-vault", "gcp-secret-manager", "custom"]
|
|
},
|
|
"path": {
|
|
"type": "string",
|
|
"description": "Path/key in secret provider"
|
|
},
|
|
"required": {
|
|
"type": "boolean",
|
|
"description": "Whether secret is required",
|
|
"default": true
|
|
},
|
|
"rotation": {
|
|
"type": "object",
|
|
"description": "Secret rotation configuration",
|
|
"properties": {
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"interval": {
|
|
"type": "integer",
|
|
"description": "Rotation interval in seconds"
|
|
},
|
|
"handler": {
|
|
"type": "string",
|
|
"description": "Rotation handler function reference"
|
|
}
|
|
}
|
|
},
|
|
"encryption": {
|
|
"type": "object",
|
|
"properties": {
|
|
"algorithm": {
|
|
"type": "string",
|
|
"enum": ["aes-256-gcm", "aes-256-cbc", "rsa-4096"]
|
|
},
|
|
"keyId": {
|
|
"type": "string",
|
|
"description": "Encryption key identifier"
|
|
}
|
|
}
|
|
},
|
|
"accessControl": {
|
|
"type": "object",
|
|
"properties": {
|
|
"roles": {
|
|
"type": "array",
|
|
"items": { "type": "string" }
|
|
},
|
|
"environments": {
|
|
"type": "array",
|
|
"items": { "type": "string" }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"provider": {
|
|
"type": "object",
|
|
"required": ["name", "type"],
|
|
"properties": {
|
|
"name": {
|
|
"type": "string",
|
|
"description": "Provider name"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"description": "Provider type",
|
|
"enum": ["env", "file", "remote", "database", "vault", "custom"]
|
|
},
|
|
"priority": {
|
|
"type": "integer",
|
|
"description": "Provider priority (higher = checked first)",
|
|
"default": 0
|
|
},
|
|
"enabled": {
|
|
"type": "boolean",
|
|
"description": "Enable provider",
|
|
"default": true
|
|
},
|
|
"options": {
|
|
"type": "object",
|
|
"description": "Provider-specific options",
|
|
"properties": {
|
|
"path": {
|
|
"type": "string",
|
|
"description": "File path (for file provider)"
|
|
},
|
|
"url": {
|
|
"type": "string",
|
|
"description": "Remote URL (for remote provider)"
|
|
},
|
|
"format": {
|
|
"type": "string",
|
|
"enum": ["json", "yaml", "env", "toml", "ini"],
|
|
"description": "Configuration format"
|
|
},
|
|
"watch": {
|
|
"type": "boolean",
|
|
"description": "Watch for changes",
|
|
"default": false
|
|
},
|
|
"pollInterval": {
|
|
"type": "integer",
|
|
"description": "Polling interval in seconds (for remote provider)"
|
|
},
|
|
"cache": {
|
|
"type": "boolean",
|
|
"description": "Cache configuration",
|
|
"default": true
|
|
},
|
|
"cacheTTL": {
|
|
"type": "integer",
|
|
"description": "Cache TTL in seconds"
|
|
}
|
|
},
|
|
"additionalProperties": true
|
|
},
|
|
"loader": {
|
|
"type": "string",
|
|
"description": "Custom loader function reference"
|
|
}
|
|
}
|
|
},
|
|
"validationConfig": {
|
|
"type": "object",
|
|
"properties": {
|
|
"strict": {
|
|
"type": "boolean",
|
|
"description": "Fail on unknown variables",
|
|
"default": false
|
|
},
|
|
"onError": {
|
|
"type": "string",
|
|
"description": "Error handling strategy",
|
|
"enum": ["throw", "warn", "ignore"],
|
|
"default": "throw"
|
|
},
|
|
"validateOnLoad": {
|
|
"type": "boolean",
|
|
"description": "Validate immediately on load",
|
|
"default": true
|
|
},
|
|
"coerceTypes": {
|
|
"type": "boolean",
|
|
"description": "Automatically coerce types (e.g., string '123' to number)",
|
|
"default": true
|
|
},
|
|
"removeUnknown": {
|
|
"type": "boolean",
|
|
"description": "Remove unknown variables",
|
|
"default": false
|
|
},
|
|
"customValidator": {
|
|
"type": "string",
|
|
"description": "Custom validation function reference"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|