Skip to content

Instantly share code, notes, and snippets.

@thomsbg
Created March 3, 2015 22:16
Show Gist options
  • Save thomsbg/e4192fb778626409a4a6 to your computer and use it in GitHub Desktop.
Save thomsbg/e4192fb778626409a4a6 to your computer and use it in GitHub Desktop.
rich-text json-schema
$schema: 'http://json-schema.org/draft-04/schema#'
type: object
properties:
ops:
type: array
items:
oneOf:
- type: object
properties:
insert:
type: string
attributes:
allOf:
- ref: '#/definitions/inlineFormats'
- additionalProperties: false
- type: object
properties:
insert:
type: string
enum: ['\n']
attributes:
allOf:
- ref: '#/definitions/inlineFormats'
- ref: '#/definitions/lineFormats'
- additionalProperties: false
- type: object
properties:
insert:
type: integer
enum: [1]
attributes:
ref: '#/definitions/embedFormats'
additionalProperties: false
additionalProperties: false
definitions:
inlineFormats:
type: object
minProperties: 1
properties:
bold:
enum: [true]
italic:
enum: [true]
embedFormats:
type: object
minProperties: 1
properties:
image:
type: object
required: ['id']
properties:
id:
type: integer
src:
type: string
format: uri
caption:
type: string
lineFormats:
type: object
minProperties: 1
properties:
thirdheader:
enum: [true]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment