Skip to content

Instantly share code, notes, and snippets.

@paulgoetze
Last active April 29, 2022 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulgoetze/95d8d85f34145bec5413a6bd25f80b9c to your computer and use it in GitHub Desktop.
Save paulgoetze/95d8d85f34145bec5413a6bd25f80b9c to your computer and use it in GitHub Desktop.
Testing Your Python API App with JSON Schema - tests/support/schemas/user.json
// tests/support/schemas/user.json
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "User response schema",
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"type": {"enum": ["users"]},
"id": {"type": "number"},
"attributes": {
"type": "object",
"properties": {
"email": {"type": "string", "format": "email"},
"username": {"type": "string"}
},
"required": ["email", "username"]
}
},
"required": ["type", "id", "attributes"]
}
},
"additionalProperties": false,
"required": ["data"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment