bpeterso2000
3/24/2016 - 2:42 AM

JSONSchema for Micro Web Scraper configuration files

JSONSchema for Micro Web Scraper configuration files

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "title": "Micro Web Scraper",
    "description": "describes requests.get() args/kwargs & nested XPaths",
    "properties": {
        "_url":     { "type": "string" },
        "_params":  { "type": "object" },
        "_headers": { "type": "object" }
    },
    "$ref": "#/definitions/xpath_object",
    "additionalProperties": false,
    "definitions": {
        "xpath": { "type": "string" },
        "xpath_object": {
            "type": "object",
            "patternProperties": {
                "^[^_].+": { "anyOf": [
                    { "$ref": "#/definitions/xpath" },
                    { "$ref": "#/definitions/xpath_sequence" }
            ]}},
            "additionalProperties": false
        },
        "xpath_sequence": {
            "type": "array",
            "items": [
                { "$ref": "#/definitions/xpath" },
                { "anyOf": [
                    { "$ref": "#/definitions/xpath_object" },
                    { "$ref": "#/definitions/xpath_sequence" }
                ]}
            ],
            "minItems": 2,
            "maxItems": 2
        }
    }
}