{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wenmarpro-com/json-schema/wenmarpro-com-payroll-deductions-schema.json",
  "title": "PayrollDeductions",
  "description": "The deductions from one regular pay in Ontario, by CRA's T4127 formulas.",
  "x-generated": "2026-11-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wenmarpro-com-open-openapi.json#/components/schemas/PayrollDeductions",
  "type": "object",
  "required": [
    "province",
    "frequency",
    "periods_per_year",
    "pay_date",
    "gross",
    "federal_claim",
    "provincial_claim",
    "year_to_date",
    "employee",
    "net_pay",
    "employer",
    "factors",
    "edition",
    "note",
    "pdoc_url",
    "attribution"
  ],
  "properties": {
    "attribution": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The data this answer came from; none, the engine's tables are the data."
    },
    "edition": {
      "$ref": "#/$defs/PayrollEdition",
      "description": "The edition of T4127 used, and its dates."
    },
    "employee": {
      "$ref": "#/$defs/PayrollEmployee",
      "description": "The employee's deductions on this pay, in dollars."
    },
    "employer": {
      "$ref": "#/$defs/PayrollEmployer",
      "description": "The employer's share on this pay, in dollars."
    },
    "factors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PayrollFactor"
      },
      "description": "Every T4127 factor used, with the value used and what it means."
    },
    "federal_claim": {
      "$ref": "#/$defs/PayrollClaim",
      "description": "The federal claim amount used, and whether it is the basic amount (claim code 1)."
    },
    "frequency": {
      "type": "string",
      "description": "The frequency slug: `weekly`, `biweekly`, `semi-monthly` or `monthly`."
    },
    "gross": {
      "type": "number",
      "format": "double",
      "description": "The gross pay for the period, in dollars."
    },
    "net_pay": {
      "type": "number",
      "format": "double",
      "description": "Gross pay less the employee's deductions, in dollars."
    },
    "note": {
      "type": "string",
      "description": "The note that the answer is an estimate."
    },
    "pay_date": {
      "type": "string",
      "description": "The pay date, `YYYY-MM-DD`."
    },
    "pay_date_note": {
      "type": [
        "string",
        "null"
      ],
      "description": "Said when the pay date was moved into the tables held."
    },
    "pdoc_url": {
      "type": "string",
      "description": "CRA's Payroll Deductions Online Calculator."
    },
    "periods_per_year": {
      "type": "integer",
      "format": "int32",
      "description": "Pay periods in the year.",
      "minimum": 0
    },
    "province": {
      "type": "string",
      "description": "\"ON\"."
    },
    "provincial_claim": {
      "$ref": "#/$defs/PayrollClaim",
      "description": "The Ontario claim amount used, and whether it is the basic amount (claim code 1)."
    },
    "year_to_date": {
      "$ref": "#/$defs/PayrollYearToDate",
      "description": "What was deducted and earned on earlier pays this calendar year."
    }
  },
  "$defs": {
    "PayrollClaim": {
      "type": "object",
      "description": "A claim amount used, in dollars, and whether it is the tables' basic amount.",
      "required": [
        "amount",
        "basic"
      ],
      "properties": {
        "amount": {
          "type": "number",
          "format": "double",
          "description": "The claim amount, in dollars."
        },
        "basic": {
          "type": "boolean",
          "description": "`true` when the amount is the tables' basic amount (claim code 1)."
        }
      }
    },
    "PayrollEdition": {
      "type": "object",
      "description": "The edition of T4127 the answer was worked out with.",
      "required": [
        "number",
        "title",
        "effective",
        "valid_until"
      ],
      "properties": {
        "effective": {
          "type": "string",
          "description": "The first pay date the tables cover, `YYYY-MM-DD`."
        },
        "number": {
          "type": "integer",
          "format": "int32",
          "description": "The edition number.",
          "minimum": 0
        },
        "title": {
          "type": "string",
          "description": "\"T4127 Payroll Deductions Formulas, 123rd edition\"."
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "description": "Where CRA publishes the edition."
        },
        "valid_until": {
          "type": "string",
          "description": "The last pay date the tables cover, `YYYY-MM-DD`."
        }
      }
    },
    "PayrollEmployee": {
      "type": "object",
      "description": "The employee's deductions on one pay, in dollars.",
      "required": [
        "federal_tax",
        "provincial_tax",
        "total_tax",
        "cpp",
        "cpp2",
        "ei",
        "total"
      ],
      "properties": {
        "cpp": {
          "type": "number",
          "format": "double",
          "description": "CPP (base and first additional)."
        },
        "cpp2": {
          "type": "number",
          "format": "double",
          "description": "CPP2."
        },
        "ei": {
          "type": "number",
          "format": "double",
          "description": "EI."
        },
        "federal_tax": {
          "type": "number",
          "format": "double",
          "description": "Federal income tax."
        },
        "provincial_tax": {
          "type": "number",
          "format": "double",
          "description": "Ontario income tax."
        },
        "total": {
          "type": "number",
          "format": "double",
          "description": "Income tax, CPP, CPP2 and EI."
        },
        "total_tax": {
          "type": "number",
          "format": "double",
          "description": "Federal and Ontario income tax."
        }
      }
    },
    "PayrollEmployer": {
      "type": "object",
      "description": "The employer's share on one pay, in dollars.",
      "required": [
        "cpp",
        "cpp2",
        "ei",
        "total"
      ],
      "properties": {
        "cpp": {
          "type": "number",
          "format": "double",
          "description": "CPP (base and first additional)."
        },
        "cpp2": {
          "type": "number",
          "format": "double",
          "description": "CPP2."
        },
        "ei": {
          "type": "number",
          "format": "double",
          "description": "EI."
        },
        "total": {
          "type": "number",
          "format": "double",
          "description": "CPP, CPP2 and EI."
        }
      }
    },
    "PayrollFactor": {
      "type": "object",
      "description": "One T4127 factor used, with the value used and what it means.",
      "required": [
        "name",
        "value",
        "meaning"
      ],
      "properties": {
        "meaning": {
          "type": "string",
          "description": "What the factor means."
        },
        "name": {
          "type": "string",
          "description": "The name the engine gives the factor."
        },
        "value": {
          "type": "number",
          "format": "double",
          "description": "The value used, after rounding."
        }
      }
    },
    "PayrollYearToDate": {
      "type": "object",
      "description": "What was deducted and earned on earlier pays this calendar year, in dollars.",
      "required": [
        "cpp",
        "cpp2",
        "ei",
        "pensionable"
      ],
      "properties": {
        "cpp": {
          "type": "number",
          "format": "double",
          "description": "CPP (base and first additional) deducted earlier this year."
        },
        "cpp2": {
          "type": "number",
          "format": "double",
          "description": "CPP2 deducted earlier this year."
        },
        "ei": {
          "type": "number",
          "format": "double",
          "description": "EI deducted earlier this year."
        },
        "pensionable": {
          "type": "number",
          "format": "double",
          "description": "Pensionable earnings earlier this year."
        }
      }
    }
  }
}