{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/editsquare/json-schema/editsquare-template-schema.json",
  "title": "Template",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/editsquare-templates-api-openapi.yml#/components/schemas/Template",
  "allOf": [
    {
      "$ref": "#/$defs/TemplateSummary"
    },
    {
      "type": "object",
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TemplateField"
          }
        }
      },
      "required": [
        "fields"
      ]
    }
  ],
  "$defs": {
    "TemplateField": {
      "type": "object",
      "properties": {
        "key": {
          "type": "string",
          "description": "The key to use in a render's `values` object."
        },
        "label": {
          "type": [
            "string",
            "null"
          ]
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": "string",
          "description": "What the field drives."
        },
        "widget": {
          "type": [
            "string",
            "null"
          ],
          "description": "How the editor renders the input."
        },
        "default_value": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "description": "Used when a render omits this key."
        }
      },
      "required": [
        "key",
        "label",
        "description",
        "kind",
        "widget",
        "default_value"
      ]
    },
    "TemplateSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "project_id": {
          "type": "string"
        },
        "target_composition_id": {
          "type": "string",
          "description": "The composition this template renders."
        },
        "field_count": {
          "type": "number"
        }
      },
      "required": [
        "id",
        "name",
        "description",
        "project_id",
        "target_composition_id",
        "field_count"
      ]
    }
  }
}