{
    "title": "Formula Test Schema",
    "description": "JSON Schema (v4) for testing purposes",
    "$schema": "http://json-schema.org/draft-04/schema#",
    "type": "object",
    "properties": {
        "string": {
            "type": "string"
        },
        "string_required": {
            "type": "string",
            "description": "string input which is required"
        },
        "string_minlength_maxlength": {
            "type": "string",
            "description": "string input with minLength and maxLength properties set",
            "minLength": 5,
            "maxLength": 10
        },
        "string_textarea": {
            "type": "string",
            "description": "string input rendered as textarea due to form definition",
            "default": "1917 \"Artik\" was buildt in Balsfjord for Hans Olsen, Meyer Olsen and Lorentrs Olsen. She was transferred to Th. \u00d8ien P/R Troms\u00f8.\n(Ref.: Magnus Sefland: Register of Norwegian Sealers / Norges Handelsfl\u00e5te 1923 / Byfogden i Troms\u00f8, Skipsregister)\n\n1919: \"Artik\" was sold to Hagbart Kr\u00e6mer, Kristian Olsen and Th. \u00d8yen. They owned 1/3 each. They owned \"Arktik\" till she was wrecked in 1928.\n(Ref.: Byfogden i Troms\u00f8, Skipsregister.)\n\n1920: Fishing register T 13 T.\n(Ref.: Norske skipsforlis i 1928.)\n\n1922: The owner of \"Arktik\": Hagbart Kr\u00e6mer, Kristian Olsen and Th. \u00d8ien. Capt. Kr. Olsen. The \"Artik\" was arrested by the Russian, but later retured to Troms\u00f8,  loaded with pelts and blubber.\n(Ref.: Byfogden i Troms\u00f8, Skipsregister / Nils A. Yreberg: \"Troms\u00f8 Bys Historie III\"\n\n1928: 15 Norwegian sealers were lost whilst sealing in 1928. Thes were \"Artik\", \"Sleipner\", \"Johan\", \"Drivis\" and \"Heimen\" of Troms\u00f8, \"Aurora\" and \"Onward\" of Vard\u00f8, \"Brandalingen\", \"Rem\u00f8\", \"Polarhavet\" and \"Haugar\" of \u00c5lesund, \"Stors\u00e6len\" of Bod\u00f8, \"Tovik\" and \"Kvitbj\u00f8rn\" of Harstad and \"Tordenskjold\" of Balsfjord\". The previous year (1927) seven Norwegian sealers were lost whilst sealing.\n\"Artik\" was wrecked in the White Sea whilst sealing on 24th April 1928. The crew taken up by the \"Polartind\".\n(Ref.: Norske skipsforlis i 1928 / Norske skipsforlis i 1927 / Byfogden i Troms\u00f8, Skipsregister / Magnus Seflands Register of Norwegian sealers, Norsk Polarinstitutt).",
            "condition": "string==='foo'"
        },
        "string_datetime": {
            "type": "string",
            "description": "string input with date-time format property set",
            "format": "date-time"
        },
        "string_date": {
            "type": "string",
            "description": "string input with date format property set",
            "format": "date"
        },
        "string_year": {
            "type": "string",
            "description": "string input with year format property set",
            "format": "year"
        },
        "string_yearmonth": {
            "type": "string",
            "description": "string input with year-month format property set",
            "format": "year-month"
        },
        "string_time": {
            "type": "string",
            "description": "string input with time format property set",
            "format": "time"
        },
        "string_enum_default": {
            "type": "string",
            "description": "string input with enum and default properties set",
            "enum": [
                "foo",
                "bar",
                "baz",
                "qux"
            ],
            "default": "bar"
        },
        "string_color": {
            "type": "string",
            "description": "string input with color format property set",
            "format": "color"
        },
        "integer_maximum": {
            "type": "integer",
            "description": "integer input with maximum property set",
            "maximum": 10
        },
        "number_default": {
            "type": [
                "number",
                "null"
            ],
            "description": "number input with default property set",
            "default": 123
        },
        "number_minimum_maximum": {
            "type": "number",
            "description": "number input with both minimum and maximum properties set",
            "minimum": 0,
            "maximum": 1
        },
        "boolean": {
            "type": "boolean",
            "description": "boolean input without additional properties"
        },
        "array_object": {
            "type": "array",
            "description": "array input with items type property set to object",
            "items": {
                "type": "object",
                "properties": {
                    "string_default": {
                        "type": "string",
                        "description": "string input with default property set",
                        "default": "foobar"
                    },
                    "number": {
                        "type": "number",
                        "description": "required number input"
                    }
                },
                "required": [
                    "number"
                ]
            },
            "minItems": 1
        },
        "array_object2": {
            "type": "array",
            "description": "array input with items type property set to object",
            "items": {
                "type": "object",
                "properties": {
                    "string_default": {
                        "type": "string",
                        "description": "string input with default property set",
                        "default": "foobar"
                    },
                    "number": {
                        "type": "number",
                        "description": "required number input"
                    }
                },
                "required": [
                    "number"
                ]
            },
            "minItems": 1
        },
        "array_string_enum": {
            "type": "array",
            "description": "array input with items type and enum properties set",
            "items": {
                "type": "string",
                "enum": [
                    "foo",
                    "bar",
                    "baz",
                    "qux"
                ]
            }
        },
        "array_string": {
            "type": "array",
            "description": "array input with items type property set to string",
            "items": {
                "type": "string",
                "minLength": 5,
                "description": "string with minLength 5"
            }
        },
        "array_hierarchy": {
            "type": "array",
            "description": "first level array",
            "items": {
                "type": "object",
                "properties": {
                    "sub_array_one": {
                        "type": "array",
                        "description": "second level array one",
                        "items": {
                            "type": "object",
                            "properties": {
                                "sub_sub_array_one": {
                                    "type": "array",
                                    "description": "third level array one",
                                    "items": {
                                        "type": "object",
                                        "properties": {
                                            "obj_1_1_1": {
                                                "type": "string"
                                            },
                                            "obj_1_1_2": {
                                                "type": "number"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "autocomplete": {
            "type": "string"
        },
        "autocomplete2": {
            "type": "string"
        },
        "autocomplete3": {
            "type": "string"
        },
        "people": {
            "description": "People involved in creating the dataset, roles from http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml with 'editor' (meaning metadata editor) added",
            "type": "array",
            "additionalItems": false,
            "required": [
                "first_name",
                "last_name",
                "roles",
                "organisation"
            ],
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "id": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "first_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "last_name": {
                        "type": "string"
                    },
                    "roles": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "author",
                                "principalInvestigator",
                                "processor",
                                "pointOfContact",
                                "editor"
                            ]
                        }
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "homepage": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^http(s)?://"
                    },
                    "organisation": {
                        "type": [
                            "string",
                            "null"
                        ]
                    }
                }
            }
        },
        "gcmd": {
            "description": "GCMD DIF object, see http://gcmd.gsfc.nasa.gov/add/difguide/index.html",
            "type": "object",
            "properties": {
                "locations": {
                    "description": "DIF element Location",
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": true
                    }
                },
                "projects": {
                    "description": "DIF element Project",
                    "type": "array"
                },
                "resolutions": {
                    "description": "DIF element Data_Resolution",
                    "type": "array"
                },
                "disciplines": {
                    "description": "DIF element Discipline",
                    "type": "array"
                },
                "idn_nodes": {
                    "description": "DIF element IDN_Node",
                    "type": "array"
                },
                "paleo_temporal_coverage": {
                    "description": "DIF element Paleo_Temporal_Coverage",
                    "type": "array"
                },
                "instruments": {
                    "description": "DIF instruments (DIF element Sensor_Name)",
                    "type": "array"
                },
                "platforms": {
                    "description": "DIF platforms (DIF element Source_Name)",
                    "type": "array"
                },
                "references": {
                    "description": "DIF element Reference",
                    "type": "array"
                },
                "extended": {
                    "description": "DIF element Extended_Metadata)",
                    "type": "array"
                },
                "citation": {
                    "description": "DIF element Data_Set_Citation",
                    "type": "array"
                },
                "sciencekeywords": {
                    "description": "DIF element Parameters (aka. Science Keywords)",
                    "type": "array",
                    "additionalItems": false,
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "properties": {
                            "Category": {
                                "type": "string"
                            },
                            "Topic": {
                                "type": "string"
                            },
                            "Term": {
                                "type": "string"
                            },
                            "Variable_Level_1": {
                                "type": "string"
                            },
                            "Variable_Level_2": {
                                "type": "string"
                            },
                            "Variable_Level_3": {
                                "type": "string"
                            },
                            "Detailed_Variable": {
                                "type": "string"
                            }
                        }
                    }
                }
            }
        },
        "placenames": {
            "type": "array",
            "additionalItems": false,
            "items": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                    "placename": {
                        "type": "string"
                    },
                    "area": {
                        "type": "string"
                    },
                    "country": {
                        "description": "Country code like ISO 3611-1, except 'NO' for Norway, including Svalbard and Jan Mayen, Bouvet\u00f8ya, and Peter I \u00d8y. 'AQ' = Antarctica.",
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^(([A-Z]|[a-z]){2})$"
                    }
                }
            }
        },
        "organisations": {
            "description": "Organisations connected to the dataset",
            "type": "array",
            "additionalItems": false,
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "name": {
                        "type": "string"
                    },
                    "gcmd_short_name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "roles": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "author",
                                "originator",
                                "owner",
                                "pointOfContact",
                                "principalInvestigator",
                                "publisher",
                                "resourceProvider"
                            ]
                        }
                    },
                    "email": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "additionalItems": false,
                        "format": "email"
                    },
                    "homepage": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^http(s)?://"
                    }
                },
                "required": [
                    "name",
                    "roles"
                ]
            }
        },
        "links": {
            "description": "Links to data, references, project, parent, doi, related, self, alternate, etc. See IANA's registry: http://www.iana.org/assignments/link-relations/link-relations.xhtml and the Atom Format RFC: http://tools.ietf.org/html/rfc4287 and ",
            "type": "array",
            "additionalItems": false,
            "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "rel": {
                        "type": "string",
                        "enum": [
                            "related",
                            "service",
                            "metadata",
                            "project",
                            "publication",
                            "datacentre",
                            "parent",
                            "internal",
                            "doi",
                            "data",
                            "via",
                            "edit",
                            "alternate"
                        ]
                    },
                    "href": {
                        "type": "string",
                        "format": "uri"
                    },
                    "title": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "hreflang": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "length": {
                        "type": [
                            "number",
                            "null"
                        ]
                    },
                    "type": {
                        "type": "string"
                    },
                    "hash": {
                        "type": "array"
                    },
                    "etag": {
                        "type": "string"
                    },
                    "modified": {
                        "type": "string"
                    },
                    "acccessed": {
                        "type": "string"
                    }
                },
                "required": [
                    "href"
                ]
            }
        }
    },
    "required": [
        "string_required"
    ]
}