Skip to content

Commit

Permalink
test: Extend fuzzing
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Dygalo <dmitry@dygalo.dev>
  • Loading branch information
Stranger6667 committed Sep 16, 2024
1 parent f9bb59f commit f9afda4
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fuzz/dict
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,10 @@
"default"
"examples"
"$comment"

# Dialects
"https://json-schema.org/draft/2020-12/schema"
"https://json-schema.org/draft/2019-09/schema"
"http://json-schema.org/draft-07/schema#"
"http://json-schema.org/draft-06/schema#"
"http://json-schema.org/draft-04/schema#"
35 changes: 35 additions & 0 deletions fuzz/seeds/compile/draft-2020-12-1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"$id": "https://example.com/address.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "An address similar to http://microformats.org/wiki/h-card",
"type": "object",
"properties": {
"postOfficeBox": {
"type": "string"
},
"extendedAddress": {
"type": "string"
},
"streetAddress": {
"type": "string"
},
"locality": {
"type": "string"
},
"region": {
"type": "string"
},
"postalCode": {
"type": "string"
},
"countryName": {
"type": "string"
}
},
"required": [ "locality", "region", "countryName" ],
"dependentRequired": {
"postOfficeBox": [ "streetAddress" ],
"extendedAddress": [ "streetAddress" ]
}
}

29 changes: 29 additions & 0 deletions fuzz/seeds/compile/draft-2020-12-2
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$id": "https://example.com/blog-post.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "A representation of a blog post",
"type": "object",
"required": ["title", "content", "author"],
"properties": {
"title": {
"type": "string"
},
"content": {
"type": "string"
},
"publishedDate": {
"type": "string",
"format": "date-time"
},
"author": {
"$ref": "https://example.com/user-profile.schema.json"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
}
}

48 changes: 48 additions & 0 deletions fuzz/seeds/compile/draft-2020-12-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$id": "https://example.com/calendar.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "A representation of an event",
"type": "object",
"required": [ "dtstart", "summary" ],
"properties": {
"startDate": {
"type": "string",
"description": "Event starting time"
},
"endDate": {
"type": "string",
"description": "Event ending time"
},
"summary": {
"type": "string"
},
"location": {
"type": "string"
},
"url": {
"type": "string"
},
"duration": {
"type": "string",
"description": "Event duration"
},
"recurrenceDate": {
"type": "string",
"description": "Recurrence date"
},
"recurrenceDule": {
"type": "string",
"description": "Recurrence rule"
},
"category": {
"type": "string"
},
"description": {
"type": "string"
},
"geo": {
"$ref": "https://example.com/geographical-location.schema.json"
}
}
}

65 changes: 65 additions & 0 deletions fuzz/seeds/compile/draft-2020-12-4
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"$id": "https://example.com/device.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"deviceType": {
"type": "string"
}
},
"required": ["deviceType"],
"oneOf": [
{
"properties": {
"deviceType": { "const": "smartphone" }
},
"$ref": "https://example.com/smartphone.schema.json"
},
{
"properties": {
"deviceType": { "const": "laptop" }
},
"$ref": "https://example.com/laptop.schema.json"
}
]
}

{
"$id": "https://example.com/smartphone.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"brand": {
"type": "string"
},
"model": {
"type": "string"
},
"screenSize": {
"type": "number"
}
},
"required": ["brand", "model", "screenSize"]
}

{
"$id": "https://example.com/laptop.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"brand": {
"type": "string"
},
"model": {
"type": "string"
},
"processor": {
"type": "string"
},
"ramSize": {
"type": "number"
}
},
"required": ["brand", "model", "processor", "ramSize"]
}

0 comments on commit f9afda4

Please sign in to comment.