{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/snitcher/json-schema/snitcher-store-custom-field-request-schema.json",
  "title": "Store Custom Field Request",
  "description": "Request body for creating a custom field definition",
  "x-generated": "2026-11-16",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/snitcher-openapi.yml#/components/schemas/StoreCustomFieldRequest",
  "required": [
    "name",
    "type"
  ],
  "properties": {
    "name": {
      "description": "The human-readable name of the field",
      "type": "string",
      "maxLength": 255
    },
    "type": {
      "description": "The data type of the field",
      "type": "string"
    },
    "key": {
      "description": "The machine-readable key. Must start with a lowercase letter and contain only lowercase letters, numbers, and underscores. Generated from the name when omitted.",
      "type": [
        "string",
        "null"
      ],
      "maxLength": 255
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 1000
    },
    "visible_in_spotter": {
      "description": "Expose this field's values in the Spotter API response. Off by default: exposed values become readable on your website by any script that can access the Spotter response.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "field_rules": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "description": "The rule type",
            "type": "string"
          },
          "config": {
            "type": [
              "object",
              "null"
            ]
          }
        },
        "type": "object"
      }
    },
    "options": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "required": [
          "key",
          "label"
        ],
        "properties": {
          "key": {
            "type": "string",
            "maxLength": 255
          },
          "label": {
            "type": "string",
            "maxLength": 255
          },
          "color": {
            "type": [
              "string",
              "null"
            ],
            "maxLength": 50
          }
        },
        "type": "object"
      }
    }
  },
  "type": "object"
}