Created
March 8, 2019 14:51
-
-
Save dacioromero/f5caffdef35509d9b5d241a9bb526e47 to your computer and use it in GitHub Desktop.
Reddit Post DRYed for https://medium.com/p/71e0ebb840ae
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$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