Skip to content

Commit b190375

Browse files
authored
Merge pull request #74 from the-grid/placeholder_type
Placeholder type
2 parents 53c23bf + b0c928d commit b190375

File tree

8 files changed

+115
-25
lines changed

8 files changed

+115
-25
lines changed

examples/contentblock.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,31 @@
5656
height: 216
5757
faces:
5858
-
59-
x: 50.61038563900384,
60-
y: 70.03941296843249,
61-
width: 63.029722675405246,
62-
height: 63.029722675405246,
63-
neighbors: 4,
59+
x: 50.61038563900384
60+
y: 70.03941296843249
61+
width: 63.029722675405246
62+
height: 63.029722675405246
63+
neighbors: 4
6464
confidence: 0.4109060300000006
6565
colors:
6666
- [ 213, 188, 135 ]
6767
- [ 59, 50, 90 ]
6868
- [ 139, 114, 114 ]
6969
- [ 112, 104, 140 ]
7070
- [ 148, 148, 164 ]
71+
-
72+
_valid: true
73+
_name: 'interactive'
74+
_data:
75+
id: "bdcc6765-114a-4184-977d-b01d3132ef69"
76+
type: 'interactive'
77+
html: '<iframe src="https://google.com"></iframe>'
78+
-
79+
_valid: true
80+
_name: 'placeholder'
81+
_data:
82+
id: "bdcc6765-114a-4184-977d-b01d3132ef69"
83+
type: 'placeholder'
7184
-
7285
_valid: false
7386
_name: 'text-h1-join-evolution-invalid-author'
@@ -167,3 +180,25 @@
167180
updated_at: null
168181
text: "AI Websites That Design Themselves"
169182
length: 34
183+
-
184+
_valid: false
185+
_name: 'invalid-author'
186+
_data:
187+
id: "9a502705-bb6c-4b03-95ee-492dbdd295e4"
188+
item: "8a342d34-bdc1-427d-9b34-4b3392828d69"
189+
type: "h1"
190+
src: null
191+
html: "<h1>AI Websites That Design Themselves</h1>"
192+
metadata:
193+
title: "Join the Evolution"
194+
datePublished: "2014-10-05T04:37:05.900Z"
195+
description: "AI Websites That Design Themselves\nJoin the Evolution\n\n\nBecome a Founding Member"
196+
"@type": "Product"
197+
"@context": "http://schema.org"
198+
author:
199+
name: 'Some Person'
200+
score: 0,
201+
created_at: '2014-05-08T13:22:59.000Z'
202+
updated_at: null
203+
text: "AI Websites That Design Themselves"
204+
length: 34

schemata/contentblock.yaml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,12 @@ properties:
6363
oneOf:
6464
- { type: 'null' }
6565
- { type: 'string', format: 'date-time' }
66-
anyOf:
67-
- { '$ref': 'headline.json' }
68-
- { '$ref': 'text.json' }
69-
- { '$ref': 'cta.json' }
70-
- { '$ref': 'media.json' }
71-
- { '$ref': 'list.json' }
72-
73-
required: [type, html]
66+
allOf:
67+
- { required: [type] }
68+
- oneOf:
69+
- { '$ref': 'headline.json' }
70+
- { '$ref': 'text.json' }
71+
- { '$ref': 'cta.json' }
72+
- { '$ref': 'image.json' }
73+
- { '$ref': 'list.json' }
74+
- { '$ref': 'placeholder.json' }

schemata/cta.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ properties:
1010
id:
1111
"$ref": "base.json#/definitions/uuid"
1212
type:
13-
"$ref": "contentblock.json#/definitions/type"
13+
description: Block type
14+
example: "text"
15+
type: string
16+
enum:
17+
- cta
1418
html:
1519
"$ref": "contentblock.json#/definitions/html"
1620
verb:
@@ -37,6 +41,3 @@ properties:
3741
type: integer
3842

3943
required: [type, html]
40-
oneOf:
41-
- { required: [url] }
42-
- { required: [cta] }

schemata/headline.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ properties:
1010
id:
1111
"$ref": "base.json#/definitions/uuid"
1212
type:
13-
"$ref": "contentblock.json#/definitions/type"
13+
description: Block type
14+
example: "text"
15+
type: string
16+
enum:
17+
- headline
18+
- h1
19+
- h2
20+
- h3
21+
- h4
22+
- h5
23+
- h6
1424
html:
1525
"$ref": "contentblock.json#/definitions/html"
1626
text:
@@ -21,5 +31,4 @@ properties:
2131
description: Length of extracted text
2232
example: 18
2333
type: integer
24-
25-
required: [type, html]
34+
required: [html]

schemata/image.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,25 @@ properties:
1010
id:
1111
"$ref": "base.json#/definitions/uuid"
1212
type:
13-
"$ref": "contentblock.json#/definitions/type"
13+
description: Block type
14+
example: "image"
15+
type: string
16+
enum:
17+
- image
18+
- video
19+
- audio
20+
- article
21+
- location
22+
- interactive
1423
html:
1524
"$ref": "contentblock.json#/definitions/html"
1625
src:
1726
"$ref": "contentblock.json#/definitions/src"
1827
cover:
1928
"$ref": "media.json#/definitions/cover"
29+
title:
30+
type: string
31+
caption:
32+
type: string
2033

21-
required: [id, type, html, src]
34+
required: [type, html]

schemata/list.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ properties:
99
id:
1010
"$ref": "base.json#/definitions/uuid"
1111
type:
12-
"$ref": "contentblock.json#/definitions/type"
12+
description: Block type
13+
example: "text"
14+
type: string
15+
enum:
16+
- list
1317
html:
1418
"$ref": "contentblock.json#/definitions/html"
1519
items:

schemata/placeholder.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: placeholder.json
3+
"$schema": "http://json-schema.org/draft-04/schema"
4+
title: HTML placeholder
5+
description: "Placeholder for content being shared"
6+
type:
7+
- object
8+
properties:
9+
id:
10+
"$ref": "base.json#/definitions/uuid"
11+
type:
12+
description: Block type
13+
example: "text"
14+
type: string
15+
enum:
16+
- placeholder
17+
html:
18+
"$ref": "contentblock.json#/definitions/html"
19+
20+
required: [type]

schemata/text.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@ properties:
99
id:
1010
"$ref": "base.json#/definitions/uuid"
1111
type:
12-
"$ref": "contentblock.json#/definitions/type"
12+
description: Block type
13+
example: "text"
14+
type: string
15+
enum:
16+
- text
17+
- code
18+
- quote
19+
- hr
20+
- unknown
1321
html:
1422
"$ref": "contentblock.json#/definitions/html"
1523
text:
@@ -20,5 +28,4 @@ properties:
2028
description: Length of extracted text
2129
example: 7
2230
type: integer
23-
2431
required: [type, html]

0 commit comments

Comments
 (0)