Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

JSON Schema for Calendars

Micah Saul edited this page May 19, 2016 · 1 revision

Sample calendar data:

{
    "state_abbreviation": "ny",
    "slug": "new-york",
    "title": "New York",
    "important_dates": [
        {
            "date": "03-25-2016",
            "date_type": "Voter Registration Deadline"
        },
        {
            "date": "04-12-2016",
            "date_type": "Absentee Ballot Request"
        },
        {
            "date": "04-18-2016",
            "date_type": "Absentee Ballot Return"
        },
        {
            "date": "06-28-2016",
            "date_type": "Presidential Preference Primary Election"
        }
    ]
}

And a json schema definition:

{
    "$schema": "http://json-schema.org/schema#",
    "title": "Voting and Registration Dates Schema",
    "description": "A schema for storing important voting related dates by state.",
    "id": "https://vote.usa.gov/dates_schema.json",
    "type": "object",

    "definitions": {
        "date": {
            "type": "object",
            "properties": {
                "date": { "type": "string" },
                "date_type": {
                    "type": "string",
                    "enum": [
                        "Absentee Ballot Request Deadline",
                        "Absentee Ballot Return Deadline",
                        "Absentee Ballot Online Deadline",
                        "Voter Registration Deadline",
                        "Voter Registration Deadline (In Person)",
                        "Voter Registration Deadline (By Mail)",
                        "Voter Registration Deadline (Online)",
                        "Early Voting/ In Person Absentee Voting",
                        "Presidential Preference Primary Election",
                        "Primary Election",
                        "Election",
                        "Special Election",
                        "Special General Election",
                        "Special Runoff Election",
                        "Primary Runoff Election",
                        "Runoff Election"
                    ]
                }
            }
        }
    },

    "properties": {
        "slug": { "type": "string" },
        "state_abbreviation": { "type": "string" },
        "title": { "type": "string" },
        "important_dates": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/date"
            }
        }
    }
}
Clone this wiki locally