Skip to content

Instantly share code, notes, and snippets.

@dacioromero
Created March 8, 2019 14:51
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 dacioromero/f5caffdef35509d9b5d241a9bb526e47 to your computer and use it in GitHub Desktop.
Save dacioromero/f5caffdef35509d9b5d241a9bb526e47 to your computer and use it in GitHub Desktop.
Reddit Post DRYed for https://medium.com/p/71e0ebb840ae
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Post",
"description": "A Reddit post and its comments",
"type": "object",
"definitions": {
"votes": {
"type": "object",
"properties": {
"up": {
"type": "integer",
"minimum": 0
},
"down": {
"type": "integer",
"minimum": 0
}
}
},
"textContent": {
"type": "string",
"minLength": 16
},
"comments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"$ref": "#/definitions/textContent"
},
"votes": {
"$ref": "#/definitions/votes"
},
"comments": {
"$ref": "#/definitions/comments"
}
},
"required": [
"content"
]
}
}
},
"properties": {
"title": {
"type": "string",
"minLength": 8,
"maxLength": 32
},
"content": {
"anyOf": [
{
"type": "string",
"format": "uri",
"pattern": "^https?://"
},
{
"$ref": "#/definitions/textContent"
}
]
},
"votes": {
"$ref": "#/definitions/votes"
},
"comments": {
"$ref": "#/definitions/comments"
},
},
"required": [
"title",
"content"
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment