This repository has been archived by the owner on Aug 30, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from kylog/json-example
Move to json
- Loading branch information
Showing
8 changed files
with
258 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
/pkg/ | ||
/spec/reports/ | ||
/tmp/ | ||
MAINTAINERS | ||
/MAINTAINERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,23 @@ | ||
# This project, topsikrit, has top-secret awesome sauce. | ||
# | ||
# Btw, note that this comment was human-edited and will be preserved | ||
# even if you add/remove maintainers using the gem. Nifty! | ||
|
||
maintainers: { | ||
version: 1 | ||
issues: "https://github.com/csprojects/topsikrit/issues" | ||
# This is a very interesting comment. It will also be preserved. | ||
roles: { | ||
core: { | ||
"ada": {}, | ||
"turing": {}, | ||
}, | ||
subsystem: { | ||
"gracehopper": { subsystem: "ENIAC" }, | ||
}, | ||
} | ||
people: { | ||
"ada": { | ||
name: "Ada Lovelace" | ||
email: "ada@example.com" | ||
}, | ||
"gracehopper": { | ||
name: "Grace Hopper" | ||
email: "admiral.grace.hopper@usnavy.gov" | ||
}, | ||
"turing": { | ||
name: "Alan Turing" | ||
email: "at@cambridge.edu" | ||
}, | ||
{ | ||
"version": 1, | ||
"issues": "https://github.com/graceland/issues", | ||
"people": [ | ||
{ | ||
"github": "gracehopper", | ||
"email": "admiral.grace.hopper@usnavy.gov", | ||
"name": "Grace Hopper", | ||
"comment": "Maintains ENIAC subsystem" | ||
}, | ||
{ | ||
"github": "turing", | ||
"email": "at@cambridge.edu", | ||
"name": "Alan Turing", | ||
"comment": "Passed his own test" | ||
}, | ||
{ | ||
"github": "ada", | ||
"email": "ada@example.com", | ||
"name": "Ada Lovelace" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"version": 1, | ||
"maintained": false, | ||
"issues": "https://github.com/graceland/issues", | ||
"people": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"title": "Maintainers file format", | ||
"type": "object", | ||
"additionalProperties": true, | ||
"required": [ "version", "issues", "people" ], | ||
"properties": { | ||
"version": { | ||
"description": "Version of this file format. Initially only: 1", | ||
"type": "number", | ||
"minimum": 1, | ||
"maximum": 1 | ||
}, | ||
"issues": { | ||
"description": "Where to file issues", | ||
"type": "string" | ||
}, | ||
"maintained": { | ||
"description": "Is this repo maintained? Optional field, but set false to make clear that a repo is not maintained.", | ||
"type": "boolean" | ||
}, | ||
"people": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": false, | ||
"required": [ "github" ], | ||
"properties": { | ||
"github": { | ||
"description": "The maintainer's github id. Note that this is the only requied field.", | ||
"type": "string" | ||
}, | ||
"email": { | ||
"description": "The maintainer's email address. Optional, and if present, no format is enforced, so uses like 'fry at puppet' are fine.", | ||
"type": "string" | ||
}, | ||
"name": { | ||
"description": "The maintainer's name. Optional.", | ||
"type": "string" | ||
}, | ||
"comment": { | ||
"description": "Optional comment field. May be handy for identifying subsystem ownership or just general awesomeness.", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{ | ||
"id": "http://json-schema.org/draft-04/schema#", | ||
"$schema": "http://json-schema.org/draft-04/schema#", | ||
"description": "Core schema meta-schema", | ||
"definitions": { | ||
"schemaArray": { | ||
"type": "array", | ||
"minItems": 1, | ||
"items": { "$ref": "#" } | ||
}, | ||
"positiveInteger": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"positiveIntegerDefault0": { | ||
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] | ||
}, | ||
"simpleTypes": { | ||
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] | ||
}, | ||
"stringArray": { | ||
"type": "array", | ||
"items": { "type": "string" }, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
}, | ||
"type": "object", | ||
"properties": { | ||
"id": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"$schema": { | ||
"type": "string", | ||
"format": "uri" | ||
}, | ||
"title": { | ||
"type": "string" | ||
}, | ||
"description": { | ||
"type": "string" | ||
}, | ||
"default": {}, | ||
"multipleOf": { | ||
"type": "number", | ||
"minimum": 0, | ||
"exclusiveMinimum": true | ||
}, | ||
"maximum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMaximum": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"minimum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMinimum": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"maxLength": { "$ref": "#/definitions/positiveInteger" }, | ||
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, | ||
"pattern": { | ||
"type": "string", | ||
"format": "regex" | ||
}, | ||
"additionalItems": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{ "$ref": "#" } | ||
], | ||
"default": {} | ||
}, | ||
"items": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/schemaArray" } | ||
], | ||
"default": {} | ||
}, | ||
"maxItems": { "$ref": "#/definitions/positiveInteger" }, | ||
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, | ||
"uniqueItems": { | ||
"type": "boolean", | ||
"default": false | ||
}, | ||
"maxProperties": { "$ref": "#/definitions/positiveInteger" }, | ||
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, | ||
"required": { "$ref": "#/definitions/stringArray" }, | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "type": "boolean" }, | ||
{ "$ref": "#" } | ||
], | ||
"default": {} | ||
}, | ||
"definitions": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"properties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"patternProperties": { | ||
"type": "object", | ||
"additionalProperties": { "$ref": "#" }, | ||
"default": {} | ||
}, | ||
"dependencies": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ "$ref": "#" }, | ||
{ "$ref": "#/definitions/stringArray" } | ||
] | ||
} | ||
}, | ||
"enum": { | ||
"type": "array", | ||
"minItems": 1, | ||
"uniqueItems": true | ||
}, | ||
"type": { | ||
"anyOf": [ | ||
{ "$ref": "#/definitions/simpleTypes" }, | ||
{ | ||
"type": "array", | ||
"items": { "$ref": "#/definitions/simpleTypes" }, | ||
"minItems": 1, | ||
"uniqueItems": true | ||
} | ||
] | ||
}, | ||
"allOf": { "$ref": "#/definitions/schemaArray" }, | ||
"anyOf": { "$ref": "#/definitions/schemaArray" }, | ||
"oneOf": { "$ref": "#/definitions/schemaArray" }, | ||
"not": { "$ref": "#" } | ||
}, | ||
"dependencies": { | ||
"exclusiveMaximum": [ "maximum" ], | ||
"exclusiveMinimum": [ "minimum" ] | ||
}, | ||
"default": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require 'json' | ||
require 'json-schema' | ||
|
||
describe 'the maintainers schema' do | ||
it 'validates against the json meta schema' do | ||
json_meta_schema = JSON.parse(File.read('schema/json-meta-schema.json')) | ||
maintainers_schema = JSON.parse(File.read('schema/maintainers.json')) | ||
|
||
JSON::Validator.validate!(json_meta_schema, maintainers_schema) | ||
# JSON::Validator.validate!(@schema, json) | ||
end | ||
end | ||
|
||
describe 'the maintainers example' do | ||
it 'validates against the maintainers schema' do | ||
maintainers_schema = JSON.parse(File.read('schema/maintainers.json')) | ||
maintainers_example = JSON.parse(File.read('MAINTAINERS-example')) | ||
|
||
JSON::Validator.validate!(maintainers_schema, maintainers_example) | ||
end | ||
end | ||
|
||
describe 'the maintainers unmaintained example' do | ||
it 'validates against the maintainers schema' do | ||
maintainers_schema = JSON.parse(File.read('schema/maintainers.json')) | ||
maintainers_example = JSON.parse(File.read('MAINTAINERS-unmaintained_example')) | ||
|
||
JSON::Validator.validate!(maintainers_schema, maintainers_example) | ||
end | ||
end |