Skip to content
This repository was archived by the owner on Nov 2, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Jekyll products
.sass-cache/
_site/
node_modules/
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
language: ruby
dist: trusty
sudo: false
node_js:
- node
before_script:
- npm install ajv-cli
- PATH="./node_modules/.bin/:$PATH"
script:
- bundle exec jekyll build
- ajv test -s schema -d "_includes/person.json" --valid
- ajv test -s schema -d "_includes/example1/schema*.json" --valid
- ajv test -s _includes/example1/schema1.json -d _includes/example1/instance.json --valid
- ajv test -s _includes/example1/schema2.json -d _includes/example1/instance.json --valid
- ajv test -s _includes/example1/schema3.json -d _includes/example1/instance.json --valid
- ajv test -s _includes/example1/schema4.json -d _includes/example1/instance.json --valid
- ajv test -s _includes/example1/schema5.json -d _includes/example1/instance.json --valid
- ajv test -s schema -d _includes/example1/set_schema.json --valid
- ajv test -s _includes/example1/set_schema.json -d _includes/example1/set_instance.json -r geo --valid
- ajv test -s schema -d "_includes/example2/schema*.json" --valid
- ajv test -s schema -d "_includes/example2/entry_schema*.json" --valid
- ajv test -s schema -d "_includes/example2/storage_schema*.json" --valid
- ajv test -s _includes/example2/schema1.json -d _includes/example2/instance.json --valid
- ajv test -s _includes/example2/schema2.json -d _includes/example2/instance.json -r _includes/example2/entry_schema3.json --valid
- ajv test -s schema -d address -d calendar -d card -d geo --valid
8 changes: 4 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ header_pages:
- examples.md
- implementations.md

collections:
docs:
output: true
permalink: "/:title:output_ext"
exclude:
- README.md
- Gemfile
- node_modules

gems:
- jekyll-relative-links
6 changes: 6 additions & 0 deletions _includes/example1/instance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"id": 1,
"name": "A green door",
"price": 12.50,
"tags": ["home", "green"]
}
6 changes: 6 additions & 0 deletions _includes/example1/schema1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object"
}
13 changes: 13 additions & 0 deletions _includes/example1/schema2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
}
},
"required": ["id"]
}
17 changes: 17 additions & 0 deletions _includes/example1/schema3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"name": {
"description": "Name of the product",
"type": "string"
}
},
"required": ["id", "name"]
}
21 changes: 21 additions & 0 deletions _includes/example1/schema4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"name": {
"description": "Name of the product",
"type": "string"
},
"price": {
"type": "number",
"exclusiveMinimum": 0
}
},
"required": ["id", "name", "price"]
}
29 changes: 29 additions & 0 deletions _includes/example1/schema5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"name": {
"description": "Name of the product",
"type": "string"
},
"price": {
"type": "number",
"exclusiveMinimum": 0
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
}
},
"required": ["id", "name", "price"]
}
31 changes: 31 additions & 0 deletions _includes/example1/set_instance.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[
{
"id": 2,
"name": "An ice sculpture",
"price": 12.50,
"tags": ["cold", "ice"],
"dimensions": {
"length": 7.0,
"width": 12.0,
"height": 9.5
},
"warehouseLocation": {
"latitude": -78.75,
"longitude": 20.4
}
},
{
"id": 3,
"name": "A blue mouse",
"price": 25.50,
"dimensions": {
"length": 3.1,
"width": 1.0,
"height": 1.0
},
"warehouseLocation": {
"latitude": 54.4,
"longitude": -32.7
}
}
]
44 changes: 44 additions & 0 deletions _includes/example1/set_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "Product set",
"type": "array",
"items": {
"title": "Product",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "number"
},
"name": {
"type": "string"
},
"price": {
"type": "number",
"exclusiveMinimum": 0
},
"tags": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},
"dimensions": {
"type": "object",
"properties": {
"length": {"type": "number"},
"width": {"type": "number"},
"height": {"type": "number"}
},
"required": ["length", "width", "height"]
},
"warehouseLocation": {
"description": "Coordinates of the warehouse with the product",
"$ref": "http://json-schema.org/geo"
}
},
"required": ["id", "name", "price"]
}
}
24 changes: 24 additions & 0 deletions _includes/example2/entry_schema1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "schema for an fstab entry",
"type": "object",
"required": [ "storage" ],
"properties": {
"storage": {
"type": "object",
"oneOf": [
{ "$ref": "#/definitions/diskDevice" },
{ "$ref": "#/definitions/diskUUID" },
{ "$ref": "#/definitions/nfs" },
{ "$ref": "#/definitions/tmpfs" }
]
}
},
"definitions": {
"diskDevice": {},
"diskUUID": {},
"nfs": {},
"tmpfs": {}
}
}
34 changes: 34 additions & 0 deletions _includes/example2/entry_schema2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "schema for an fstab entry",
"type": "object",
"required": [ "storage" ],
"properties": {
"storage": {
"type": "object",
"oneOf": [
{ "$ref": "#/definitions/diskDevice" },
{ "$ref": "#/definitions/diskUUID" },
{ "$ref": "#/definitions/nfs" },
{ "$ref": "#/definitions/tmpfs" }
]
},
"fstype": {
"enum": [ "ext3", "ext4", "btrfs" ]
},
"options": {
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true
},
"readonly": { "type": "boolean" }
},
"definitions": {
"diskDevice": {},
"diskUUID": {},
"nfs": {},
"tmpfs": {}
}
}
83 changes: 83 additions & 0 deletions _includes/example2/entry_schema3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"id": "http://some.site.somewhere/entry-schema#",
"$schema": "http://json-schema.org/draft-06/schema#",
"description": "schema for an fstab entry",
"type": "object",
"required": [ "storage" ],
"properties": {
"storage": {
"type": "object",
"oneOf": [
{ "$ref": "#/definitions/diskDevice" },
{ "$ref": "#/definitions/diskUUID" },
{ "$ref": "#/definitions/nfs" },
{ "$ref": "#/definitions/tmpfs" }
]
},
"fstype": {
"enum": [ "ext3", "ext4", "btrfs" ]
},
"options": {
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"uniqueItems": true
},
"readonly": { "type": "boolean" }
},
"definitions": {
"diskDevice": {
"properties": {
"type": { "enum": [ "disk" ] },
"device": {
"type": "string",
"pattern": "^/dev/[^/]+(/[^/]+)*$"
}
},
"required": [ "type", "device" ],
"additionalProperties": false
},
"diskUUID": {
"properties": {
"type": { "enum": [ "disk" ] },
"label": {
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
}
},
"required": [ "type", "label" ],
"additionalProperties": false
},
"nfs": {
"properties": {
"type": { "enum": [ "nfs" ] },
"remotePath": {
"type": "string",
"pattern": "^(/[^/]+)+$"
},
"server": {
"type": "string",
"oneOf": [
{ "format": "hostname" },
{ "format": "ipv4" },
{ "format": "ipv6" }
]
}
},
"required": [ "type", "server", "remotePath" ],
"additionalProperties": false
},
"tmpfs": {
"properties": {
"type": { "enum": [ "tmpfs" ] },
"sizeInMB": {
"type": "integer",
"minimum": 16,
"maximum": 512
}
},
"required": [ "type", "sizeInMB" ],
"additionalProperties": false
}
}
}
Loading