{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/arkrel-com/json-schema/arkrel-com-schema-schema.json",
  "title": "Schema",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/arkrel-com-schemas-api-openapi.yml#/components/schemas/Schema",
  "allOf": [
    {
      "$ref": "#/$defs/SchemaInput"
    },
    {
      "type": "object",
      "required": [
        "id",
        "created_at"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    }
  ],
  "$defs": {
    "SchemaInput": {
      "type": "object",
      "required": [
        "name",
        "fields"
      ],
      "properties": {
        "name": {
          "type": "string",
          "minLength": 1,
          "description": "Required, non-empty (api/src/routes/v1/schemas.ts's validateSchemaInput rejects an empty string as MISSING_NAME, the same as a missing field)."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "Null when the schema was created with no description (src/lib/serialize.ts's serializeSchema passes SchemaRow.description straight through, which is `string | null`)."
        },
        "fields": {
          "type": "array",
          "minItems": 1,
          "description": "Must be non-empty (validateSchemaInput rejects `[]` as MISSING_FIELDS).",
          "items": {
            "type": "object",
            "required": [
              "name",
              "type"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "description": "Required, non-empty (validateSchemaInput rejects an empty string as INVALID_FIELD)."
              },
              "type": {
                "type": "string",
                "enum": [
                  "string",
                  "number",
                  "boolean",
                  "date",
                  "array"
                ]
              },
              "description": {
                "type": "string"
              },
              "required": {
                "type": "boolean",
                "default": false
              }
            }
          }
        }
      }
    }
  }
}