{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/good-grants/json-schema/good-grants-field-schema.json",
  "title": "Field",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/good-grants-openapi.yaml#/components/schemas/Field",
  "type": "object",
  "properties": {
    "applicant_read_access": {
      "type": "boolean",
      "description": "Whether applicants can view this field."
    },
    "applicant_write_access": {
      "type": "boolean",
      "description": "Whether applicants can edit this field."
    },
    "auto_scoring": {
      "type": "integer",
      "description": "Score awarded automatically for the field, or `0` when automatic scoring is not configured."
    },
    "categories": {
      "type": "array",
      "description": "Categories the field is associated with, or `[\"*\"]` when it applies to every category.\n\n`category_count` reports `all` in that case, so a caller can read that instead of testing for\nthe marker. The same shape is used by the `categories` property of a tab.",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "slug": {
                "type": "string",
                "description": "Short URL-safe identifier for the category."
              },
              "link": {
                "type": "string",
                "format": "uri",
                "description": "Canonical URL for the category resource."
              },
              "name": {
                "type": "object",
                "description": "Map of translated strings keyed by locale code (for example, `en_GB` or `fr_FR`).",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "string",
            "enum": [
              "*"
            ]
          }
        ]
      }
    },
    "category_count": {
      "description": "How many categories the field is associated with.",
      "oneOf": [
        {
          "type": "integer",
          "minimum": 0,
          "description": "Number of categories the field is associated with."
        },
        {
          "type": "string",
          "description": "The value `all`, when the field applies to every category.",
          "enum": [
            "all"
          ]
        },
        {
          "type": "null",
          "description": "Null, when the field collects user data and is not scoped to categories at all."
        }
      ]
    },
    "conditional_field": {
      "type": [
        "object",
        "null"
      ],
      "description": "Field whose value controls whether this field is shown, or `null` when the field is not conditional.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the controlling field."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the controlling field resource."
        },
        "name": {
          "type": "object",
          "description": "Display name of the controlling field, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "created": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time when the field was created."
    },
    "file_types": {
      "type": "array",
      "description": "Permitted file extensions for file fields, empty when no restriction applies.",
      "items": {
        "type": "string"
      }
    },
    "form": {
      "type": [
        "object",
        "null"
      ],
      "description": "Form the field belongs to, or `null` when the field is not attached to a form.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the form."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the form resource."
        },
        "name": {
          "type": "object",
          "description": "Display name of the form, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "help_text": {
      "type": "object",
      "description": "Help text shown for the field, as an HTML fragment keyed by locale code.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "hint_text": {
      "type": "object",
      "description": "Hint text shown for the field, as an HTML fragment keyed by locale code.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "label": {
      "type": "object",
      "description": "Label of the field, as an HTML fragment keyed by locale code.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "max_file_size": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Maximum upload size in megabytes for file fields, or `null` when no limit applies."
    },
    "maximum_characters": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Maximum number of characters accepted, or `null` when no limit applies."
    },
    "maximum_words": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Maximum number of words accepted, or `null` when no limit applies."
    },
    "minimum_characters": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Minimum number of characters required, or `null` when no limit applies."
    },
    "minimum_words": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Minimum number of words required, or `null` when no limit applies."
    },
    "options": {
      "type": "array",
      "description": "Selectable options for choice fields (for example, drop-down or radio). Empty when the field type has no options.",
      "items": {
        "type": "string"
      }
    },
    "order": {
      "type": "integer",
      "description": "Position of the field within its tab."
    },
    "protection": {
      "type": "string",
      "description": "Protection level governing access to the data for the field (for example, `standard`, `elevated`, or `maximum`)."
    },
    "registration": {
      "type": [
        "string",
        "null"
      ],
      "description": "Registration attribute the field is mapped to, or `null` if unmapped."
    },
    "required": {
      "type": "boolean",
      "description": "Whether a value is required for the field."
    },
    "resource": {
      "type": "string",
      "description": "Resource the field collects data for (for example, `applications`, `contributors`, `referees`, `attachments`, or `users`)."
    },
    "schema": {
      "type": [
        "object",
        "null"
      ],
      "description": "Column structure of a table field, or `null` for every other field type.",
      "properties": {
        "columns": {
          "type": "array",
          "description": "Columns of the table, in the order they appear.",
          "items": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "description": "Spreadsheet-style column letter used to address cells of the field."
              },
              "label": {
                "type": "object",
                "description": "Heading of the column, keyed by locale code.",
                "additionalProperties": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "searchable": {
      "type": "boolean",
      "description": "Whether the field is included in search."
    },
    "season": {
      "type": "object",
      "description": "Season the field belongs to.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the season."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the season resource."
        },
        "name": {
          "type": "object",
          "description": "Display name of the season, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "slug": {
      "type": "string",
      "description": "Short URL-safe identifier for the field."
    },
    "tab": {
      "type": [
        "object",
        "null"
      ],
      "description": "Tab the field belongs to, or `null` when the field is not attached to a tab.",
      "properties": {
        "slug": {
          "type": "string",
          "description": "Short URL-safe identifier for the tab."
        },
        "link": {
          "type": "string",
          "format": "uri",
          "description": "Canonical URL for the tab resource."
        },
        "name": {
          "type": "object",
          "description": "Display name of the tab, keyed by locale code.",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "title": {
      "type": "object",
      "description": "Plain-text title of the field, keyed by locale code.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "type": {
      "type": "string",
      "description": "Field type (for example, `text`, `textarea`, `drop-down-list`, `file`, `currency`, or `date`)."
    },
    "updated": {
      "type": "string",
      "format": "date-time",
      "description": "Date and time when the field was last updated."
    },
    "visibility": {
      "type": "array",
      "description": "Contexts in which the field is visible (for example, `qualifying`, `top_pick`, `voting`, `gallery`, or `scoring`).",
      "items": {
        "type": "string"
      }
    }
  }
}