Skip to content

Commit 48ffc2a

Browse files
authored
docs(validator): include more complete examples & intro to JSON Schema (#389)
* docs(validation): use new structure * docs(validation): include complete examples
1 parent a64f766 commit 48ffc2a

File tree

3 files changed

+423
-93
lines changed

3 files changed

+423
-93
lines changed

Diff for: docs/shared/validation_basic_eventbridge_event.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"id": "cdc73f9d-aea9-11e3-9d5a-835b769c0d9c",
3+
"detail-type": "Scheduled Event",
4+
"source": "aws.events",
5+
"account": "123456789012",
6+
"time": "1970-01-01T00:00:00Z",
7+
"region": "us-east-1",
8+
"resources": [
9+
"arn:aws:events:us-east-1:123456789012:rule/ExampleRule"
10+
],
11+
"detail": {
12+
"message": "hello hello",
13+
"username": "blah blah"
14+
}
15+
}

Diff for: docs/shared/validation_basic_jsonschema.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
INPUT = {
2+
"$schema": "http://json-schema.org/draft-07/schema",
3+
"$id": "http://example.com/example.json",
4+
"type": "object",
5+
"title": "Sample schema",
6+
"description": "The root schema comprises the entire JSON document.",
7+
"examples": [{"message": "hello world", "username": "lessa"}],
8+
"required": ["message", "username"],
9+
"properties": {
10+
"message": {
11+
"$id": "#/properties/message",
12+
"type": "string",
13+
"title": "The message",
14+
"examples": ["hello world"],
15+
"maxLength": 100,
16+
},
17+
"username": {
18+
"$id": "#/properties/username",
19+
"type": "string",
20+
"title": "The username",
21+
"examples": ["lessa"],
22+
"maxLength": 30,
23+
},
24+
},
25+
}
26+
27+
OUTPUT = {
28+
"$schema": "http://json-schema.org/draft-07/schema",
29+
"$id": "http://example.com/example.json",
30+
"type": "object",
31+
"title": "Sample outgoing schema",
32+
"description": "The root schema comprises the entire JSON document.",
33+
"examples": [{"statusCode": 200, "body": "response"}],
34+
"required": ["statusCode", "body"],
35+
"properties": {
36+
"statusCode": {"$id": "#/properties/statusCode", "type": "integer", "title": "The statusCode"},
37+
"body": {"$id": "#/properties/body", "type": "string", "title": "The response"},
38+
},
39+
}

0 commit comments

Comments
 (0)