Skip to content

Commit 0aa57da

Browse files
Charlie OwenPhil Sturgeon
authored andcommitted
Additional refactoring.
1 parent 2b751eb commit 0aa57da

14 files changed

+232
-162
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,4 @@ before_script:
88
- PATH="./node_modules/.bin/:$PATH"
99
script:
1010
- bundle exec jekyll build
11-
- ajv test -s schema -d address -d calendar -d card -d geo --valid
12-
- ajv test -s schema -d "_includes/example/*.json" --valid
11+
- ajv test -s schema -d "learn/examples/*.json" --valid

_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ theme: minima
2828

2929
header_pages:
3030
- specification.md
31-
- examples.md
31+
- learn/index.md
3232
- implementations.md
3333

3434
exclude:

example/address.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

example/card.json

Lines changed: 0 additions & 49 deletions
This file was deleted.

example/geo.json

Lines changed: 0 additions & 10 deletions
This file was deleted.

index.md

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,47 @@ permalink: /
1010
**JSON Schema** is a vocabulary that allows you to **annotate** and **validate** JSON documents.
1111

1212

13-
Advantages
14-
----------
13+
## Advantages
1514

1615
<div class="block" style="float:left;width:50%;" markdown="1">
1716

1817
### JSON Schema
1918

20-
- describes your existing data format
21-
- clear, human- and machine-readable documentation
22-
- complete structural validation, useful for
23-
- automated testing
24-
- validating client-submitted data
19+
* Describes your existing data format(s).
20+
* Provides clear human- and machine- readable documentation.
21+
* Validates data which is useful for:
22+
* Automated testing.
23+
* Ensuring quality of client submitted data.
2524
</div>
2625

2726
<div class="block" style="float:right;width:50%;" markdown="1">
2827

2928
### JSON Hyper-Schema
3029

31-
- make any JSON format a hypermedia format - no constraints on document structure
32-
- use [URI Templates](https://tools.ietf.org/html/rfc6570) with instance data
33-
- describe client data for use with links using JSON Schema
34-
- recognize collections and collection items
30+
* Make any JSON format a hypermedia format with no constraints on document structure
31+
* Allows use of [URI Templates](https://tools.ietf.org/html/rfc6570) with instance data
32+
* Describe client data for use with links using JSON Schema.
33+
* Recognizes collections and collection items.
3534

3635
</div>
3736

38-
Project Status
39-
--------------
37+
## Project Status
4038

41-
The JSON Schema project intends to shepherd the Core, Validation, and Hyper-Schema specifications
42-
to RFC status. Currently, we are continuing to improve our self-published Internet-Drafts.
43-
The next step will be to get the drafts adopted by an IETF Working Group.
39+
The JSON Schema project intends to shepherd the Core, Validation, and Hyper-Schema specifications to RFC status. Currently, we are continuing to improve our self-published Internet-Drafts. The next step will be to get the drafts adopted by an IETF Working Group.
4440

4541
In the meantime, publication of Internet-Draft documents can be tracked through the IETF:
46-
- [JSON Schema (core)](https://datatracker.ietf.org/doc/draft-handrews-json-schema/)
47-
- [JSON Schema Validation](https://datatracker.ietf.org/doc/draft-handrews-json-schema-validation/)
48-
- [JSON Hyper-Schema](https://datatracker.ietf.org/doc/draft-handrews-json-schema-hyperschema/)
49-
- [Relative JSON Pointers](https://datatracker.ietf.org/doc/draft-handrews-relative-json-pointer/)
42+
* [JSON Schema (core)](https://datatracker.ietf.org/doc/draft-handrews-json-schema/)
43+
* [JSON Schema Validation](https://datatracker.ietf.org/doc/draft-handrews-json-schema-validation/)
44+
* [JSON Hyper-Schema](https://datatracker.ietf.org/doc/draft-handrews-json-schema-hyperschema/)
45+
* [Relative JSON Pointers](https://datatracker.ietf.org/doc/draft-handrews-relative-json-pointer/)
5046

51-
Internet-Drafts expire after six months, so our goal is to publish often enough to always have
52-
a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize
53-
the text.
47+
Internet-Drafts expire after six months, so our goal is to publish often enough to always have a set of unexpired drafts available. There may be brief gaps as we wrap up each draft and finalize the text.
5448

55-
The intention, particularly for vocabularies such as validation which have been widely
56-
implemented, is to remain as compatible as possible from draft to draft. However, these are still
57-
drafts, and given a clear enough need validated with the user community, major changes can occur.
49+
The intention, particularly for vocabularies such as validation which have been widely implemented, is to remain as compatible as possible from draft to draft. However, these are still drafts, and given a clear enough need validated with the user community, major changes can occur.
5850

59-
Progress on the next set of Internet-Drafts can be tracked on GitHub.
60-
The [draft-08](https://github.com/json-schema-org/json-schema-spec/milestone/6) milestone
61-
will track the evolving scope of the draft
51+
Progress on the next set of Internet-Drafts can be tracked on GitHub. The [draft-08](https://github.com/json-schema-org/json-schema-spec/milestone/6) milestone will track the evolving scope of the draft
6252

63-
<div style="clear:both"></div>
64-
65-
Quickstart
66-
----------
53+
## Quickstart
6754

6855
The JSON document being validated or described we call the *instance*, and the document containing the description is called the *schema*.
6956

@@ -76,25 +63,23 @@ The most basic schema is a blank JSON object, which constrains nothing, allows a
7663
You can apply constraints on an instance by adding validation keywords to the schema. For example, the "type" keyword can be used to restrict an instance to an object, array, string, number, boolean, or null:
7764

7865
```json
79-
{"type": "string"}
66+
{ "type": "string" }
8067
```
8168

8269
JSON Schema is hypermedia ready, and ideal for annotating your existing JSON-based HTTP API. JSON Schema documents are identified by URIs, which can be used in HTTP Link headers, and inside JSON Schema documents to allow recursive definitions.
8370

84-
More
85-
----
71+
## More
8672

8773
Interested? Check out:
8874

89-
- the [specification](specification.html)
90-
- some [examples](examples.md)
91-
- the growing list of [JSON (Hyper-)Schema software](implementations.html)
75+
* The [specification](./specification.md)
76+
* [Learning resources](./learn/index.md)
77+
* the growing list of [JSON (Hyper-)Schema software](./implementations.md)
9278

93-
We encourage updating to the latest specification, as described by the draft-07 meta-schemas. However, if you are still using draft-04, you may be interested in:
94-
- this [excellent guide](https://spacetelescope.github.io/understanding-json-schema/) for schema authors, from the [Space Telescope Science Institute](http://www.stsci.edu/)
79+
We encourage updating to the latest specification, as described by the draft-07 meta-schemas.
9580

9681
Questions? Feeling helpful? Get involved on:
9782

98-
- the [GitHub repo](http://github.com/json-schema-org/json-schema-spec)
99-
- the [Google Group](https://groups.google.com/forum/#!forum/json-schema)
100-
- the [Slack channel](https://join.slack.com/t/json-schema/shared_invite/enQtMjk1NDcyNDI2NTAwLTcyYmYwMjdmMmUxNzZjYzIxNGU2YjdkNzdlOGZiNjIwNDI2M2Y3NmRkYjA4YmMwODMwYjgyOTFlNWZjZjAyNjg)
83+
* [GitHub](http://github.com/json-schema-org/json-schema-spec)
84+
* [Google Groups](https://groups.google.com/forum/#!forum/json-schema)
85+
* [Slack](https://join.slack.com/t/json-schema/shared_invite/enQtMjk1NDcyNDI2NTAwLTcyYmYwMjdmMmUxNzZjYzIxNGU2YjdkNzdlOGZiNjIwNDI2M2Y3NmRkYjA4YmMwODMwYjgyOTFlNWZjZjAyNjg)

learn/examples/address.schema.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$id": "https://example.com/address.schema.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"description": "An address similar to http://microformats.org/wiki/h-card",
5+
"type": "object",
6+
"properties": {
7+
"post-office-box": {
8+
"type": "string"
9+
},
10+
"extended-address": {
11+
"type": "string"
12+
},
13+
"street-address": {
14+
"type": "string"
15+
},
16+
"locality": {
17+
"type": "string"
18+
},
19+
"region": {
20+
"type": "string"
21+
},
22+
"postal-code": {
23+
"type": "string"
24+
},
25+
"country-name": {
26+
"type": "string"
27+
}
28+
},
29+
"required": [ "locality", "region", "country-name" ],
30+
"dependencies": {
31+
"post-office-box": [ "street-address" ],
32+
"extended-address": [ "street-address" ]
33+
}
34+
}
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,47 @@
11
{
2-
"$schema": "http://json-schema.org/draft-06/schema#",
2+
"$id": "https://example.com/address.schema.json",
3+
"$schema": "http://json-schema.org/draft-07/schema#",
34
"description": "A representation of an event",
45
"type": "object",
56
"required": [ "dtstart", "summary" ],
67
"properties": {
78
"dtstart": {
8-
"format": "date-time",
99
"type": "string",
1010
"description": "Event starting time"
1111
},
1212
"dtend": {
13-
"format": "date-time",
1413
"type": "string",
1514
"description": "Event ending time"
1615
},
17-
"summary": { "type": "string" },
18-
"___location": { "type": "string" },
19-
"url": { "type": "string", "format": "uri" },
16+
"summary": {
17+
"type": "string"
18+
},
19+
"___location": {
20+
"type": "string"
21+
},
22+
"url": {
23+
"type": "string"
24+
},
2025
"duration": {
21-
"format": "time",
2226
"type": "string",
2327
"description": "Event duration"
2428
},
2529
"rdate": {
26-
"format": "date-time",
2730
"type": "string",
2831
"description": "Recurrence date"
2932
},
3033
"rrule": {
3134
"type": "string",
3235
"description": "Recurrence rule"
3336
},
34-
"category": { "type": "string" },
35-
"description": { "type": "string" },
36-
"geo": { "$ref": "http://json-schema.org/geo" }
37+
"category": {
38+
"type": "string"
39+
},
40+
"description": {
41+
"type": "string"
42+
},
43+
"geo": {
44+
"$ref": "http://example.com/geo.schema.json"
45+
}
3746
}
3847
}

0 commit comments

Comments
 (0)