Skip to content

docs(validator): include more complete examples & intro to JSON Schema #389

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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/shared/validation_basic_eventbridge_event.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"id": "cdc73f9d-aea9-11e3-9d5a-835b769c0d9c",
"detail-type": "Scheduled Event",
"source": "aws.events",
"account": "123456789012",
"time": "1970-01-01T00:00:00Z",
"region": "us-east-1",
"resources": [
"arn:aws:events:us-east-1:123456789012:rule/ExampleRule"
],
"detail": {
"message": "hello hello",
"username": "blah blah"
}
}
39 changes: 39 additions & 0 deletions docs/shared/validation_basic_jsonschema.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
INPUT = {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "Sample schema",
"description": "The root schema comprises the entire JSON document.",
"examples": [{"message": "hello world", "username": "lessa"}],
"required": ["message", "username"],
"properties": {
"message": {
"$id": "#/properties/message",
"type": "string",
"title": "The message",
"examples": ["hello world"],
"maxLength": 100,
},
"username": {
"$id": "#/properties/username",
"type": "string",
"title": "The username",
"examples": ["lessa"],
"maxLength": 30,
},
},
}

OUTPUT = {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "http://example.com/example.json",
"type": "object",
"title": "Sample outgoing schema",
"description": "The root schema comprises the entire JSON document.",
"examples": [{"statusCode": 200, "body": "response"}],
"required": ["statusCode", "body"],
"properties": {
"statusCode": {"$id": "#/properties/statusCode", "type": "integer", "title": "The statusCode"},
"body": {"$id": "#/properties/body", "type": "string", "title": "The response"},
},
}
Loading