Skip to content

Commit

Permalink
Add draft3 walkers tests based on the specification examples
Browse files Browse the repository at this point in the history
See: #83
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
  • Loading branch information
jviotti committed Nov 3, 2022
1 parent 3f43b3b commit fe897bb
Show file tree
Hide file tree
Showing 2 changed files with 156 additions and 5 deletions.
156 changes: 156 additions & 0 deletions test/walkers/jsonschema-draft3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
[
{
"name": "boolean true",
"schema": true,
"trail": [
{
"type": "jsonschema-draft3",
"path": []
}
]
},
{
"name": "boolean false",
"schema": false,
"trail": [
{
"type": "jsonschema-draft3",
"path": []
}
]
},
{
"name": "https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-3",
"schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"name": "Product",
"properties": {
"id": {
"type": "number",
"description": "Product identifier",
"required": true
},
"name": {
"description": "Name of the product",
"type": "string",
"required": true
},
"price": {
"required": true,
"type": "number",
"minimum": 0,
"required": true
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"links": [
{
"rel": "full",
"href": "{id}"
},
{
"rel": "comments",
"href": "comments/?id={id}"
}
]
},
"trail": [
{
"type": "jsonschema-draft3",
"path": []
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "id" ]
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "name" ]
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "price" ]
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "tags" ]
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "tags", "items" ]
}
]
},
{
"name": "https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-5",
"schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"description": "A person",
"type": "object",
"properties": {
"name": { "type": "string" },
"age": {
"type": "integer",
"maximum": 125
}
}
},
"trail": [
{
"type": "jsonschema-draft3",
"path": []
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "name" ]
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "age" ]
}
]
},
{
"name": "https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-5.26 (1)",
"schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"description": "An adult",
"properties": { "age": { "minimum": 21 } },
"extends": "person"
},
"trail": [
{
"type": "jsonschema-draft3",
"path": []
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "age" ]
}
]
},
{
"name": "https://datatracker.ietf.org/doc/html/draft-zyp-json-schema-03#section-5.26 (2)",
"schema": {
"$schema": "http://json-schema.org/draft-03/schema#",
"description": "Extended schema",
"properties": { "deprecated": { "type": "boolean" } },
"extends": "http://json-schema.org/draft-03/schema"
},
"trail": [
{
"type": "jsonschema-draft3",
"path": []
},
{
"type": "jsonschema-draft3",
"path": [ "properties", "deprecated" ]
}
]
}
]
5 changes: 0 additions & 5 deletions walkers/jsonschema-draft3.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,5 @@
"vocabulary": "http://json-schema.org/draft-03/schema#",
"type": "object",
"walker": "jsonschema-draft3"
},
"extends": {
"vocabulary": "http://json-schema.org/draft-03/schema#",
"type": "value",
"walker": "jsonschema-draft3"
}
}

0 comments on commit fe897bb

Please sign in to comment.