Skip to content

Commit b04ad53

Browse files
authored
Merge pull request #104 from tomcollins/root-level-deprecated
Add support for root level deprecated within schema.
2 parents 0d00f92 + 42d91f9 commit b04ad53

File tree

13 files changed

+194
-16
lines changed

13 files changed

+194
-16
lines changed

gh-pages/_includes/examples-table.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
| HTML documentation | JSON Schema |
2-
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
3-
| [Index of documents](/json-schema-static-docs/examples/examples-index.html) | n/a |
4-
| [Person](/json-schema-static-docs/examples/person.html) | [person.yml](/json-schema-static-docs/yml/person.yml) |
5-
| [Name](/json-schema-static-docs/examples/name.html) | [name.yml](/json-schema-static-docs/yml/name.yml) |
6-
| [Enum Value Documentation](/json-schema-static-docs/examples/enums.html) | [enums.yml](/json-schema-static-docs/yml/enums.yml) |
7-
| [One-of](/json-schema-static-docs/examples/oneof.html) | [oneof.yml](/json-schema-static-docs/yml/oneof.yml) |
8-
| [Draft 2019-09 - Array](/json-schema-static-docs/examples/draft-2019-09/array.html) | [draft-2019-09/array.yml](/json-schema-static-docs/yml/draft-2019-09/array.yml) |
9-
| [Draft 07 - User](/json-schema-static-docs/examples/draft-07/user.html) | [draft-07/user.yml](/json-schema-static-docs/yml/draft-07/user.yml) |
10-
| [Draft 06 - Animal](/json-schema-static-docs/examples/draft-06/animal.html) | [draft-06/animal.yml](/json-schema-static-docs/yml/draft-06/animal.yml) |
1+
| HTML documentation | JSON Schema |
2+
| --------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
3+
| [Index of documents](/json-schema-static-docs/examples/examples-index.html) | n/a |
4+
| [Person](/json-schema-static-docs/examples/person.html) | [person.yml](/json-schema-static-docs/yml/person.yml) |
5+
| [Name](/json-schema-static-docs/examples/name.html) | [name.yml](/json-schema-static-docs/yml/name.yml) |
6+
| [Enum Value Documentation](/json-schema-static-docs/examples/enums.html) | [enums.yml](/json-schema-static-docs/yml/enums.yml) |
7+
| [One-of](/json-schema-static-docs/examples/oneof.html) | [oneof.yml](/json-schema-static-docs/yml/oneof.yml) |
8+
| [Draft 2019-09 - Array](/json-schema-static-docs/examples/draft-2019-09/array.html) | [draft-2019-09/array.yml](/json-schema-static-docs/yml/draft-2019-09/array.yml) |
9+
| [Draft 2019-09 - Deprecated](/json-schema-static-docs/examples/draft-2019-09/deprecated.html) | [draft-2019-09/deprecated.yml](/json-schema-static-docs/yml/draft-2019-09/deprecated.yml) |
10+
| [Draft 07 - User](/json-schema-static-docs/examples/draft-07/user.html) | [draft-07/user.yml](/json-schema-static-docs/yml/draft-07/user.yml) |
11+
| [Draft 06 - Animal](/json-schema-static-docs/examples/draft-06/animal.html) | [draft-06/animal.yml](/json-schema-static-docs/yml/draft-06/animal.yml) |

gh-pages/assets/css/style.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,11 @@ h1 {
3838
clear: both;
3939
margin-top: 50px !important;
4040
}
41+
42+
43+
div.jssd-deprecated {
44+
background: #d94c4c;
45+
color: white;
46+
width: 100%;
47+
padding: 10px;
48+
}

gh-pages/examples/draft-06/animal.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Draft 06 - User Example
33
description: A schema demonstrating some draft 06 features
44

55
---
6+
7+
68
# Draft 06 - User Example
79

810
<p>A schema demonstrating some draft 06 features</p>

gh-pages/examples/draft-07/user.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Draft 07 - User Example
33
description: A schema demonstrating some draft 07 features
44

55
---
6+
7+
68
# Draft 07 - User Example
79

810
<p>A schema demonstrating some draft 07 features</p>

gh-pages/examples/draft-2019-09/array.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Draft 2019-09 - Array Example
33
description: A schema describing fruits and vegetables
44

55
---
6+
7+
68
# Draft 2019-09 - Array Example
79

810
<p>A schema describing fruits and vegetables</p>
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
---
2+
title: Draft 2019-09 - Deprecated Example
3+
description: A schema demonstrating use of deprecated
4+
5+
---
6+
<div class="jssd-deprecated">⚠️ This schema has been marked as deprecated.</div>
7+
8+
# Draft 2019-09 - Deprecated Example
9+
10+
<p>A schema demonstrating use of deprecated</p>
11+
12+
<table>
13+
<tbody>
14+
<tr><th>$id</th><td>https://example.com/deprecated.schema.json</td></tr>
15+
<tr><th>$schema</th><td>https://json-schema.org/draft/2019-09/schema</td></tr>
16+
</tbody>
17+
</table>
18+
19+
## Properties
20+
21+
<table><thead><tr><th colspan="2">Name</th><th>Type</th></tr></thead><tbody><tr><td colspan="2"><a href="#firstname">firstName</a></td><td>String</td></tr><tr><td colspan="2"><a href="#lastname">lastName</a></td><td>String</td></tr></tbody></table>
22+
23+
24+
## Example
25+
```
26+
{
27+
"firstName": "Neil",
28+
"lastName": "Williams"
29+
}
30+
```
31+
32+
<hr />
33+
34+
35+
36+
## firstName
37+
38+
39+
<table>
40+
<tbody>
41+
<tr>
42+
<th>Title</th>
43+
<td colspan="2">First Name</td>
44+
</tr>
45+
<tr>
46+
<th>Description</th>
47+
<td colspan="2">A persons first name</td>
48+
</tr>
49+
<tr><th>Type</th><td colspan="2">String</td></tr>
50+
<tr>
51+
<th>Required</th>
52+
<td colspan="2">No</td>
53+
</tr>
54+
55+
</tbody>
56+
</table>
57+
58+
59+
60+
61+
62+
63+
## lastName
64+
65+
66+
<table>
67+
<tbody>
68+
<tr>
69+
<th>Deprecated</th>
70+
<td colspan="2">true</td>
71+
</tr>
72+
<tr>
73+
<th>Title</th>
74+
<td colspan="2">Last Name</td>
75+
</tr>
76+
<tr>
77+
<th>Description</th>
78+
<td colspan="2">A persons last name</td>
79+
</tr>
80+
<tr><th>Type</th><td colspan="2">String</td></tr>
81+
<tr>
82+
<th>Required</th>
83+
<td colspan="2">No</td>
84+
</tr>
85+
86+
</tbody>
87+
</table>
88+
89+
90+
91+
92+
93+
94+
95+
96+
97+
98+
<hr />
99+
100+
## Schema
101+
```
102+
{
103+
"$id": "https://example.com/deprecated.schema.json",
104+
"$schema": "https://json-schema.org/draft/2019-09/schema",
105+
"title": "Draft 2019-09 - Deprecated Example",
106+
"description": "A schema demonstrating use of deprecated",
107+
"examples": [
108+
{
109+
"firstName": "Neil",
110+
"lastName": "Williams"
111+
}
112+
],
113+
"deprecated": true,
114+
"type": "object",
115+
"properties": {
116+
"firstName": {
117+
"deprecated": false,
118+
"type": "string",
119+
"title": "First Name",
120+
"description": "A persons first name"
121+
},
122+
"lastName": {
123+
"deprecated": true,
124+
"type": "string",
125+
"title": "Last Name",
126+
"description": "A persons last name"
127+
}
128+
}
129+
}
130+
```
131+
132+

gh-pages/examples/enums.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Enum Documentation
33
description: JSON schema example demonstrating documentation of enum values using the custom meta:enum keyword. This must be enabled using the enableMetaEnum config option.
44

55
---
6+
7+
68
# Enum Documentation
79

810
<p>JSON schema example demonstrating documentation of enum values using the custom meta:enum keyword. This must be enabled using the enableMetaEnum config option.</p>

gh-pages/examples/examples-index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313

1414
## Draft-2019-09
1515
- [draft-2019-09/array](draft-2019-09/array.md)
16+
- [draft-2019-09/deprecated](draft-2019-09/deprecated.md)

gh-pages/examples/name.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Name
33
description: JSON schema example for a name entity
44

55
---
6+
7+
68
# Name
79

810
<p>JSON schema example for a name entity</p>

gh-pages/examples/oneof.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: One-of
33
description: Example schema to demonstrate the use of the oneOf keyword
44

55
---
6+
7+
68
# One-of
79

810
<p>Example schema to demonstrate the use of the oneOf keyword</p>

gh-pages/examples/person.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ title: Person
33
description: JSON schema example for a person entity
44

55
---
6+
7+
68
# Person
79

810
<p>JSON schema example for a person entity</p>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"$id": https://example.com/deprecated.schema.json
2+
"$schema": https://json-schema.org/draft/2019-09/schema
3+
title: Draft 2019-09 - Deprecated Example
4+
description: A schema demonstrating use of deprecated
5+
examples:
6+
- firstName: Neil
7+
lastName: Williams
8+
deprecated: true
9+
type: object
10+
properties:
11+
firstName:
12+
deprecated: false
13+
type: string
14+
title: First Name
15+
description: A persons first name
16+
lastName:
17+
deprecated: true
18+
type: string
19+
title: Last Name
20+
description: A persons last name

templates/schema.hbs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{#if schema.deprecated}}<div class="jssd-deprecated">⚠️ This schema has been marked as deprecated.</div>{{/if}}
2+
13
{{#if schema.title}}# {{ schema.title }}{{else if schema.description}}# {{ schema.description }}{{else}}# {{/if}}
24

35
{{#if schema.title}}{{#if schema.description}}<p>{{ schema.description }}</p>{{/if}}{{/if}}
@@ -121,6 +123,12 @@
121123
<td colspan="2">{{ this.$id }}</td>
122124
</tr>
123125
{{/if}}
126+
{{#if this.deprecated}}
127+
<tr>
128+
<th>Deprecated</th>
129+
<td colspan="2">{{this.deprecated}}</td>
130+
</tr>
131+
{{/if}}
124132
{{#if this.title}}
125133
<tr>
126134
<th>Title</th>
@@ -146,12 +154,6 @@
146154
<td colspan="2">{{this.default}}</td>
147155
</tr>
148156
{{/if}}
149-
{{#if this.deprecated}}
150-
<tr>
151-
<th>Deprecated</th>
152-
<td colspan="2">{{this.deprecated}}</td>
153-
</tr>
154-
{{/if}}
155157
{{#if this.readOnly}}
156158
<tr>
157159
<th>Read Only</th>

0 commit comments

Comments
 (0)