{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://flatfilepro.com/ffspec.schema.json",
  "title": "FlatFilePro specification version 1",
  "description": "Layout rules only. Cross-field positions and ASCII output are additionally validated by core.js. See docs/FFSPEC.md for exact semantics.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "version": {
      "type": "integer",
      "const": 1
    },
    "lineEnding": {
      "type": "string",
      "enum": [
        "LF",
        "CRLF"
      ]
    },
    "finalNewline": {
      "type": "boolean"
    },
    "fields": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 100
          },
          "source": {
            "type": "string",
            "enum": [
              "column",
              "constant"
            ]
          },
          "value": {
            "type": "string",
            "maxLength": 10000
          },
          "start": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "width": {
            "type": "integer",
            "minimum": 1,
            "maximum": 10000
          },
          "align": {
            "type": "string",
            "enum": [
              "left",
              "right"
            ]
          },
          "pad": {
            "type": "string",
            "pattern": "^[ -~]$"
          },
          "type": {
            "type": "string",
            "enum": [
              "text",
              "integer",
              "decimal"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "trim": {
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "source",
          "value",
          "start",
          "width",
          "align",
          "pad",
          "type",
          "required",
          "trim"
        ]
      }
    }
  },
  "required": [
    "version",
    "lineEnding",
    "finalNewline",
    "fields"
  ]
}
