Skip to content

Schema works in V0.5 & not working in V0.8 & 1.0-dev also #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sakthiinfotec opened this issue Feb 19, 2013 · 2 comments
Closed

Schema works in V0.5 & not working in V0.8 & 1.0-dev also #67

sakthiinfotec opened this issue Feb 19, 2013 · 2 comments
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup

Comments

@sakthiinfotec
Copy link

Hi Julian,

schema1 = {"properties": {"body": {"items": {"required": True, "type": "object", "id": "0", "properties": {"timestamp": {"required": True, "type": "string", "id": "timestamp"}, "params": {"required": "false", "type": "object", "id": "params", "properties": {"Temperature": {"required": "false", "type": "object", "id": "Temperature", "properties": {"value": {"required": "false", "type": "number", "id": "value"}, "unit": {"required": "false", "type": "string", "id": "unit"}}}}}, "location": {"required": True, "type": "object", "id": "location", "properties": {"lat": {"required": True, "type": "number", "id": "lat"}, "lng": {"required": True, "type": "number", "id": "lng"}}}, "nodeid": {"required": True, "type": "string", "id": "nodeid"}}}, "required": True, "type": "array", "id": "body"}, "header": {"type": "object", "properties": {"gatewayid": {"required": True, "type": "string"}, "org": {"required": True, "type": "string"}, "type": {"required": True, "type": "string"}, "seqno": {"required": True, "type": "number"}, "streamid": {"required": True, "type": "string"}}}, "schemakey": {"required": True, "type": "string", "id": "schemakey"}}, "required": True, "type": "object", "id": "datacore0.2", "schema": "http://json-schema.org/draft-03/schema"}

schema2 = {"properties": {"body": {"items": {"required": True, "type": "object", "id": "0", "properties": {"timestamp": {"required": True, "type": "string", "id": "timestamp"}, "params": {"required": True, "type": "object", "id": "params", "properties": {"Temperature": {"required": False, "type": "object", "id": "Temperature", "properties": {"value": {"required": False, "type": "number", "id": "value"}, "unit": {"required": False, "type": "string", "id": "unit"}}}}}, "location": {"required": True, "type": "object", "id": "location", "properties": {"lat": {"required": True, "type": "number", "id": "lat"}, "lng": {"required": True, "type": "number", "id": "lng"}}}, "nodeid": {"required": True, "type": "string", "id": "nodeid"}}}, "required": True, "type": "array", "id": "body"}, "header": {"required": False, "type": "object", "id": "header", "properties": {"gatewayid": {"required": False, "type": "string", "id": "gatewayid"}, "org": {"required": False, "type": "string", "id": "org"}, "streamid": {"required": False, "type": "string", "id": "streamid"}, "type": {"required": False, "type": "string", "id": "type"}, "seqno": {"required": False, "type": "number", "id": "seqno"}}}, "schemakey": {"required": False, "type": "string", "id": "schemakey"}}}

data = {"body": [{"timestamp": "1361273664038", "params": {"Temperature": {"unit": "C", "value": 35.700000000000003}}, "nodeid": "GMR/6L/TS1", "location": {"lat": 13.081, "lng": 80.274000000000001}}], "header": {"gatewayid": "GMT/6L/GW100", "org": "example.com", "streamid": "23", "type": "DATA", "seqno": 1}, "schemakey": "CATGY_221360650604771"}

  1. If I validate schema1 against the above data in jsonschema v0.8 & v1.0.0-dev I am getting SchemaError, but works in V0.5.
  2. But with schema2 all the versions(v0.5, v0.8 & v1.0.0-dev) are working. But I want the validation should work in latest v0.8.

Could you please resolve if something is really went wrong in schema or in new Schema validator ?

Thanks,
Sakthivel

@Julian
Copy link
Member

Julian commented Feb 19, 2013

Hi. Your first schema has "true"s and "false"s in it, so it's not a valid Python JSON Schema. It's also not valid JSON, so it's just malformed. You need to have Python objects (True and False) or load something that's valid JSON.

I don't understand what you mean about the second schema, but that one is valid (and should work in 0.8).

@sakthiinfotec
Copy link
Author

Thanks Julian,

Sorry, I haven't notice the "true","false" in the schema. After I changed them to a proper Python objects, its working fine. Thanks a lot.

Julian added a commit that referenced this issue Dec 7, 2014
9208016 Merge pull request #67 from iainbeeston/defaults
f57888c Added tests around the default property
db28fee Merge pull request #63 from iainbeeston/patch-1
609944b Added the json-schema ruby gem to the list of libraries using the test suite

git-subtree-dir: json
git-subtree-split: 9208016d04c1b6774d5a17e8b037161873414edb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Invalid Not a bug, PEBKAC, or an unsupported setup
Projects
None yet
Development

No branches or pull requests

2 participants