-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Description
Given this requests response.json() (note the None instead of null):
"version": "2.3.4",
"result": "Multi-Status",
"data": [
{
"derId": 583,
"warnings": [],
"status": "success",
"error": None
}
]
}
why is it that this schema isn't sufficient:
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "",
"description": "JSON schema for the HTTP REST API response.",
"type": "object",
"properties": {
"version": {"type": "string"},
"result": {"type": "string"},
"data": {
"type": "array",
"items": {
"type": "object",
"properties": {
"derId": {"type": "integer"},
"warnings": {"type": "array"},
"status": {"type": "string"},
"error": {"type": ["null","string"]}
},
"required": ["derId", "status", "warnings", "error"]
}
}
},
"required": ["data", "result", "version"]
}
Even if I remove the requirement for the error property, jsonschema.validate() chokes on the presence of None.
I realize that None is a python thing and not valid json, as I understand it, but it is the calling of the .json() api on the API's response that introduces the None.
Thank you in advance.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels