Validation broken after upgrade to 2.5.0

195 views
Skip to first unread message

dmitry.zv...@digitalglobe.com

unread,
Jun 8, 2015, 3:28:37 PM6/8/15
to jsons...@googlegroups.com
Hello,
Recently we started getting a validation error with: "jsonschema.exceptions.RefResolutionError: unknown url type"
On the following schema and json:
1. Schema
{
    "required": [
        "name",
        "containerDescriptors",
        "inputPortDescriptors"
    ],
    "properties": {
        "containerDescriptors": {
            "minItems": 1,
            "items": {
                "$ref": "#/definitions/ContainerDescriptor"
            },
            "type": "array",
            "description": "The containers that are capable of running the task.",
            "maxItems": 1
        },
        "name": {
            "type": "string",
            "description": "A name that uniquely identifies the task descriptor."
        },
        "inputPortDescriptors": {
            "minItems": 1,
            "items": {
                "$ref": "#/definitions/PortDescriptor"
            },
            "type": "array",
            "description": "The input ports for the task."
        },
        "outputPortDescriptors": {
            "minItems": 0,
            "items": {
                "$ref": "#/definitions/PortDescriptor"
            },
            "type": "array",
            "description": "The ports that are output by the task."
        },
        "properties": {
            "additionalProperties": false,
            "required": [
                "timeout"
            ],
            "type": [
                "object",
                "null"
            ],
            "description": "Additional properties of the task.",
            "properties": {
                "isPublic": {
                    "type": "boolean",
                    "description": "Visibility of the task to other users. Defaults to false."
                },
                "timeout": {
                    "minimum": 0,
                    "type": "integer",
                    "description": "The integer of the default timeout to this task (in seconds).",
                    "maximum": 36000
                }
            }
        },
        "description": {
            "type": "string",
            "description": "A human-readable description of the function performed by this task."
        }
    },
    "additionalProperties": false,
    "definitions": {
        "PortDescriptor": {
            "required": [
                "name",
                "type"
            ],
            "type": "object",
            "properties": {
                "required": {
                    "type": "boolean",
                    "description": "Is the port required.  If not required, the system will select a reasonable default value."
                },
                "type": {
                    "type": "string",
                    "description": "The port type."
                },
                "description": {
                    "type": "string",
                    "description": "A description of the port."
                },
                "name": {
                    "type": "string",
                    "description": "The port name."
                }
            }
        },
        "ContainerDescriptor": {
            "required": [
                "type",
                "properties"
            ],
            "type": "object",
            "properties": {
                "type": {
                    "enum": [
                        "DOCKER",
                        "GPUDOCKER",
                        "AMI",
                        "TASK_DRIVER"
                    ],
                    "type": "string",
                    "description": "The container type."
                },
                "command": {
                    "type": "string",
                    "description": "The command used to launch the container."
                },
                "properties": {
                    "required": [
                        "image"
                    ],
                    "type": "object",
                    "description": "Container descriptor properties",
                    "properties": {
                        "image": {
                            "type": "string",
                            "description": "An image name that uniquely identifies the container within the GBD system."
                        },
                        "domain": {
                            "type": "string",
                            "description": "Identifies the worker domain/group/collective under which to run."
                        }
                    }
                }
            }
        }
    },
    "type": "object",
    "id": "urn:jsonschema:com:digitalglobe:taskregistry:TaskDescriptor"
}

2. JSON
task_json = """{
             "inputPortDescriptors": [
                 {
                     "required": true,
                     "description": "A string input.",
                     "name": "inputstring",
                     "type": "string"
                 }
             ],
             "containerDescriptors": [
                 {
                     "type": "DOCKER",
                     "command": "",
                     "properties": {
                         "image": "tdgp/test-success"
                     }
                 }
             ],
             "name": "no_description"
         }"""

Started happening after package upgrade to 2.5.0.
Is something wrong with the way the schema references itself?

Thanks,
Dmitry
Reply all
Reply to author
Forward
0 new messages