content/src/schemas/platform-spec.schema.json

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://github.com/margani/axeon/schemas/platform-spec.schema.json",
  "title": "Axeon Platform Specification",
  "description": "Configuration schema for Axeon Landing Zone deployments.",
  "type": "object",
  "required": ["platformId", "environment", "location", "naming"],
  "properties": {
    "platformId": {
      "type": "string",
      "description": "Unique identifier for the platform (used in resource naming).",
      "pattern": "^[a-z0-9][a-z0-9-]{1,20}$",
      "examples": ["axeon-corp", "contoso-prod"]
    },
    "environment": {
      "type": "string",
      "description": "Target environment name.",
      "enum": ["Development", "Staging", "Production"],
      "examples": ["Production"]
    },
    "testMode": {
      "type": "boolean",
      "description": "When true, performs validation only (What-If) without provisioning resources.",
      "default": false
    },
    "location": {
      "type": "string",
      "description": "Azure region for resource deployment.",
      "examples": ["uksouth", "westeurope", "eastus2"]
    },
    "naming": {
      "type": "object",
      "description": "Token-based naming convention configuration. Defines how all Azure resource names are generated.",
      "required": ["tokens", "resources", "patterns"],
      "properties": {
        "defaultLength": {
          "type": "string",
          "description": "Default token length variant when not specified in a pattern. s=short, m=medium, l=long.",
          "enum": ["s", "m", "l"],
          "default": "s"
        },
        "separator": {
          "type": "string",
          "description": "Character used to join token segments. Use empty string for no separator.",
          "default": "-",
          "maxLength": 1
        },
        "casing": {
          "type": "string",
          "description": "Case transformation applied to the final name.",
          "enum": ["lower", "upper", "none"],
          "default": "lower"
        },
        "tokens": {
          "type": "object",
          "description": "Dictionary of naming tokens. Each token has short (s), medium (m), and long (l) variants.",
          "minProperties": 1,
          "additionalProperties": {
            "$ref": "#/$defs/lengthVariants"
          }
        },
        "resources": {
          "type": "object",
          "description": "Resource type token values. Maps logical resource type keys to their {rsc} token with s/m/l variants.",
          "minProperties": 1,
          "additionalProperties": {
            "$ref": "#/$defs/lengthVariants"
          }
        },
        "patterns": {
          "type": "object",
          "description": "Naming patterns using {token} or {token:length} placeholders. Must include a 'default' key.",
          "required": ["default"],
          "properties": {
            "default": {
              "type": "string",
              "description": "Fallback pattern used when no resource-specific pattern is defined.",
              "examples": ["{rsc}-{org}-{prj}-{env}-{geo}-{typ}-{idx}"]
            }
          },
          "additionalProperties": {
            "type": "string",
            "description": "Resource-specific naming pattern. Key must match a resource type key."
          }
        },
        "overrides": {
          "type": "object",
          "description": "Per-resource-type overrides for separator, casing, charset, maxLength, and/or pattern. Used for resources with Azure naming constraints.",
          "additionalProperties": {
            "type": "object",
            "properties": {
              "pattern": {
                "type": "string",
                "description": "Override pattern for this resource type."
              },
              "separator": {
                "type": "string",
                "description": "Override separator (e.g. empty string for storage accounts).",
                "maxLength": 1
              },
              "casing": {
                "type": "string",
                "enum": ["lower", "upper", "none"]
              },
              "defaultLength": {
                "type": "string",
                "enum": ["s", "m", "l"],
                "description": "Override default token length for this resource type."
              },
              "maxLength": {
                "type": "integer",
                "description": "Maximum character length for the resource name (Azure constraint).",
                "minimum": 1,
                "maximum": 260
              },
              "charset": {
                "type": "string",
                "description": "Allowed character set. 'alphanumeric' strips everything except a-z0-9. 'alphanumericHyphen' allows hyphens.",
                "enum": ["any", "alphanumeric", "alphanumericHyphen"],
                "default": "any"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "$defs": {
    "lengthVariants": {
      "type": "object",
      "description": "Short (s), medium (m), and long (l) name variants for a token.",
      "required": ["s", "m", "l"],
      "properties": {
        "s": { "type": "string", "description": "Short variant (1-5 chars typically)." },
        "m": { "type": "string", "description": "Medium variant." },
        "l": { "type": "string", "description": "Long / descriptive variant." }
      },
      "additionalProperties": false
    }
  }
}