Add tests for JSON schema
parent
c6fdf55ff2
commit
31877f825e
16
src/cli.js
16
src/cli.js
|
@ -16,16 +16,22 @@ function run(path: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const [indent, width] = [4, 80];
|
||||||
const {types, schema} = collect(path);
|
const {types, schema} = collect(path);
|
||||||
|
|
||||||
const output = yaml.dump(types, null, null, {
|
const typesOutput = yaml.dump(types, null, null, {
|
||||||
indent: 4,
|
indent,
|
||||||
width: 80,
|
width,
|
||||||
|
}).trimRight();
|
||||||
|
|
||||||
|
const schemaOutput = stringifyJson(schema, {
|
||||||
|
indent,
|
||||||
|
maxLength: width,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(output.trimRight());
|
console.log(typesOutput);
|
||||||
console.log('--------');
|
console.log('--------');
|
||||||
console.log(stringifyJson(schema, {maxLength: 80}));
|
console.log(schemaOutput);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
console.error(ex.message);
|
console.error(ex.message);
|
||||||
console.error(ex.stack);
|
console.error(ex.stack);
|
||||||
|
|
11
tests/run.js
11
tests/run.js
|
@ -8,12 +8,13 @@ import Ajv from 'ajv';
|
||||||
import collect from '../src';
|
import collect from '../src';
|
||||||
|
|
||||||
function run(title) {
|
function run(title) {
|
||||||
let actual, expected;
|
let actual, expectedTypes, expectedSchema;
|
||||||
|
|
||||||
// Run the collector only if the suite will be checked.
|
// Run the collector only if the suite will be checked.
|
||||||
before(() => {
|
before(() => {
|
||||||
actual = collect(title + '/source.js');
|
actual = collect(title + '/source.js');
|
||||||
expected = yaml.load(fs.readFileSync(title + '/types.yaml', 'utf8'));
|
expectedTypes = yaml.load(fs.readFileSync(title + '/types.yaml', 'utf8'));
|
||||||
|
expectedSchema = JSON.parse(fs.readFileSync(title + '/schema.json', 'utf8'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not include cycles', () => {
|
it('should not include cycles', () => {
|
||||||
|
@ -21,7 +22,7 @@ function run(title) {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should provide expected types', () => {
|
it('should provide expected types', () => {
|
||||||
assert.deepEqual(actual.types, expected);
|
assert.deepEqual(actual.types, expectedTypes);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should generate valid JSON schema', () => {
|
it('should generate valid JSON schema', () => {
|
||||||
|
@ -31,6 +32,10 @@ function run(title) {
|
||||||
|
|
||||||
assert.equal(ajv.errors, null);
|
assert.equal(ajv.errors, null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should provide expected JSON schema', () => {
|
||||||
|
assert.deepEqual(actual.schema, expectedSchema);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectCycles(obj: mixed, cycles: Set<mixed> = new Set, objs: Set<mixed> = new Set) {
|
function detectCycles(obj: mixed, cycles: Set<mixed> = new Set, objs: Set<mixed> = new Set) {
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"all::A": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "number"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"all::B": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"b": {"type": "string"}},
|
||||||
|
"required": ["b"]
|
||||||
|
},
|
||||||
|
"all::X": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/all::A"},
|
||||||
|
{"$ref": "#/definitions/all::B"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"all::C": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"c": {"type": "boolean"}},
|
||||||
|
"required": ["c"]
|
||||||
|
},
|
||||||
|
"all::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"y": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/all::A"},
|
||||||
|
{"$ref": "#/definitions/all::B"},
|
||||||
|
{"$ref": "#/definitions/all::C"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["y"]
|
||||||
|
},
|
||||||
|
"all::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"z": {"$ref": "#/definitions/all::A"}},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"any::X": true,
|
||||||
|
"any::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": true},
|
||||||
|
"required": ["y"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"arrays::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"b": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"c": {"type": "array", "items": {"type": "string"}}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c"]
|
||||||
|
},
|
||||||
|
"arrays::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"b": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"c": {"type": "array", "items": {"type": "string"}}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c"]
|
||||||
|
},
|
||||||
|
"arrays::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"b": {"type": "array", "items": {"type": "string"}},
|
||||||
|
"c": {"type": "array", "items": {"type": "string"}}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"declare::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"declare::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"$ref": "#/definitions/declare::Type"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"declare::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"$ref": "#/definitions/declare::Interface"}},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"diffs::A": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}, "y": {"type": "boolean"}},
|
||||||
|
"required": ["x", "y"]
|
||||||
|
},
|
||||||
|
"diffs::B": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": {"type": "boolean"}},
|
||||||
|
"required": ["y"]
|
||||||
|
},
|
||||||
|
"diffs::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}},
|
||||||
|
"required": ["x"]
|
||||||
|
},
|
||||||
|
"diffs::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": {"type": "boolean"}},
|
||||||
|
"required": ["y"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"disorder::Z": {"type": "string"},
|
||||||
|
"disorder::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"z": {"$ref": "#/definitions/disorder::Z"}},
|
||||||
|
"required": ["z"]
|
||||||
|
},
|
||||||
|
"disorder::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": {"$ref": "#/definitions/disorder::Y"}},
|
||||||
|
"required": ["y"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"either::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"type": "boolean"}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"either::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"anyOf": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"type": "boolean"},
|
||||||
|
{"type": "number"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"either::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"elementType::X::boolean": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": {"anyOf": [{"type": "boolean"}, {"type": "string"}]}
|
||||||
|
},
|
||||||
|
"required": ["x"]
|
||||||
|
},
|
||||||
|
"elementType::P": {"const": "x"},
|
||||||
|
"elementType::Y::x": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"y": {"anyOf": [{"type": "boolean"}, {"type": "string"}]},
|
||||||
|
"yy": {"anyOf": [{"type": "boolean"}, {"type": "string"}]}
|
||||||
|
},
|
||||||
|
"required": ["y", "yy"]
|
||||||
|
},
|
||||||
|
"elementType::Z": {"anyOf": [{"type": "boolean"}, {"type": "string"}]}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"enums::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"enum": ["one", "two"]}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"enums::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"enum": ["one", "two"]}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"enums::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"enum": ["one", "two"]}},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"exact::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}, "y": {"type": "boolean"}},
|
||||||
|
"required": ["x", "y"]
|
||||||
|
},
|
||||||
|
"exact::Y": {"$ref": "#/definitions/exact::X"},
|
||||||
|
"exact::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"z": {"type": "string"}},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"externals::modules::first::A": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "boolean"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"externals::modules::first::B": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"b": {"type": "string"}},
|
||||||
|
"required": ["b"]
|
||||||
|
},
|
||||||
|
"externals::modules::first::CC": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"c": {"type": "number"}},
|
||||||
|
"required": ["c"]
|
||||||
|
},
|
||||||
|
"externals::modules::first::D": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"d": {"type": "number"}},
|
||||||
|
"required": ["d"]
|
||||||
|
},
|
||||||
|
"externals::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"$ref": "#/definitions/externals::modules::first::A"},
|
||||||
|
"b": {"$ref": "#/definitions/externals::modules::first::B"},
|
||||||
|
"c": {"$ref": "#/definitions/externals::modules::first::CC"},
|
||||||
|
"d": {"$ref": "#/definitions/externals::modules::first::D"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
},
|
||||||
|
"externals::modules::second::N": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"n": {"type": "boolean"}},
|
||||||
|
"required": ["n"]
|
||||||
|
},
|
||||||
|
"externals::modules::second::M": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"m": {"type": "string"}},
|
||||||
|
"required": ["m"]
|
||||||
|
},
|
||||||
|
"externals::modules::second::KK": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"k": {"type": "number"}},
|
||||||
|
"required": ["k"]
|
||||||
|
},
|
||||||
|
"externals::modules::second::P": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"p": {"type": "number"}},
|
||||||
|
"required": ["p"]
|
||||||
|
},
|
||||||
|
"externals::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"n": {"$ref": "#/definitions/externals::modules::second::N"},
|
||||||
|
"m": {"$ref": "#/definitions/externals::modules::second::M"},
|
||||||
|
"k": {"$ref": "#/definitions/externals::modules::second::KK"},
|
||||||
|
"p": {"$ref": "#/definitions/externals::modules::second::P"}
|
||||||
|
},
|
||||||
|
"required": ["n", "m", "k", "p"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"generics::A::string::boolean": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"t": {"type": "string"}, "k": {"type": "boolean"}},
|
||||||
|
"required": ["t", "k"]
|
||||||
|
},
|
||||||
|
"generics::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"$ref": "#/definitions/generics::A::string::boolean"}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"generics::A::f64::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"t": {"type": "number"},
|
||||||
|
"k": {"$ref": "#/definitions/generics::X"}
|
||||||
|
},
|
||||||
|
"required": ["t", "k"]
|
||||||
|
},
|
||||||
|
"generics::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"$ref": "#/definitions/generics::A::f64::X"}},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"inheritance::A": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "number"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"inheritance::B": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/inheritance::A"},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"b": {"type": "string"}},
|
||||||
|
"required": ["b"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"inheritance::C": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/inheritance::B"},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"c": {"type": "boolean"}},
|
||||||
|
"required": ["c"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"inheritance::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "number"}},
|
||||||
|
"required": ["x"]
|
||||||
|
},
|
||||||
|
"inheritance::Y": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/inheritance::X"},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": {"type": "string"}},
|
||||||
|
"required": ["y"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"inheritance::Z": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/inheritance::Y"},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"z": {"type": "boolean"}},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"intersections::A": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "number"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"intersections::B": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"b": {"type": "string"}},
|
||||||
|
"required": ["b"]
|
||||||
|
},
|
||||||
|
"intersections::X": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/intersections::A"},
|
||||||
|
{"$ref": "#/definitions/intersections::B"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"intersections::C": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"c": {"type": "boolean"}},
|
||||||
|
"required": ["c"]
|
||||||
|
},
|
||||||
|
"intersections::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"y": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/intersections::A"},
|
||||||
|
{"$ref": "#/definitions/intersections::B"},
|
||||||
|
{"$ref": "#/definitions/intersections::C"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["y"]
|
||||||
|
},
|
||||||
|
"intersections::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"z": {
|
||||||
|
"allOf": [
|
||||||
|
{"$ref": "#/definitions/intersections::A"},
|
||||||
|
{"$ref": "#/definitions/intersections::C"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"keys::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}, "b": {"type": "boolean"}},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
},
|
||||||
|
"keys::Y": {"enum": ["a", "b"]}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"maps::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {"type": "boolean"}
|
||||||
|
},
|
||||||
|
"maps::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {"type": "boolean"}
|
||||||
|
},
|
||||||
|
"maps::Couple": {
|
||||||
|
"allOf": [
|
||||||
|
{"type": "object", "additionalProperties": {"type": "boolean"}},
|
||||||
|
{"type": "object", "additionalProperties": {"type": "string"}}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"maps::Mix": {
|
||||||
|
"allOf": [
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"foo": {"type": "string"}},
|
||||||
|
"required": ["foo"]
|
||||||
|
},
|
||||||
|
{"type": "object", "additionalProperties": {"type": "boolean"}}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"maybe::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": {"oneOf": [{"type": "string"}, {"type": "null"}]},
|
||||||
|
"xx": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
|
},
|
||||||
|
"required": ["x", "xx"]
|
||||||
|
},
|
||||||
|
"maybe::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"y": {
|
||||||
|
"oneOf": [
|
||||||
|
{"type": "array", "items": {"type": "string"}},
|
||||||
|
{"type": "null"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"yy": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
|
},
|
||||||
|
"required": ["y", "yy"]
|
||||||
|
},
|
||||||
|
"maybe::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"z": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"oneOf": [{"type": "string"}, {"type": "null"}]}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"mixed::X": true,
|
||||||
|
"mixed::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": true},
|
||||||
|
"required": ["y"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"nonMaybeType::X": {"oneOf": [{"type": "string"}, {"type": "null"}]},
|
||||||
|
"nonMaybeType::Y": {"type": "string"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"objects::X": {"type": "object", "additionalProperties": true},
|
||||||
|
"objects::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"y": {"type": "object", "additionalProperties": true}
|
||||||
|
},
|
||||||
|
"required": ["y"]
|
||||||
|
},
|
||||||
|
"objects::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"z": {"type": "object", "additionalProperties": true}
|
||||||
|
},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"optionals::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}}
|
||||||
|
},
|
||||||
|
"optionals::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "boolean"}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"pragmas::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "integer"},
|
||||||
|
"b": {"type": "integer"},
|
||||||
|
"c": {"type": "number"},
|
||||||
|
"d": {"type": "number"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
},
|
||||||
|
"pragmas::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "integer"},
|
||||||
|
"b": {"type": "integer"},
|
||||||
|
"c": {"type": "number"},
|
||||||
|
"d": {"type": "number"},
|
||||||
|
"e": {"type": "string"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d", "e"]
|
||||||
|
},
|
||||||
|
"pragmas::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "integer"},
|
||||||
|
"b": {"type": "integer"},
|
||||||
|
"c": {"type": "number"},
|
||||||
|
"d": {"type": "number"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"primitives::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "string"},
|
||||||
|
"b": {"type": "number"},
|
||||||
|
"c": {"type": "boolean"},
|
||||||
|
"d": {"type": "null"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
},
|
||||||
|
"primitives::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "string"},
|
||||||
|
"b": {"type": "number"},
|
||||||
|
"c": {"type": "boolean"},
|
||||||
|
"d": {"type": "null"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
},
|
||||||
|
"primitives::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "string"},
|
||||||
|
"b": {"type": "number"},
|
||||||
|
"c": {"type": "boolean"},
|
||||||
|
"d": {"type": "null"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c", "d"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"readOnly::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}, "y": {"type": "boolean"}},
|
||||||
|
"required": ["x", "y"]
|
||||||
|
},
|
||||||
|
"readOnly::Y": {"$ref": "#/definitions/readOnly::X"},
|
||||||
|
"readOnly::Z": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"z": {"type": "string"}},
|
||||||
|
"required": ["z"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"references::A": {"type": "string"},
|
||||||
|
"references::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"$ref": "#/definitions/references::A"},
|
||||||
|
"b": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"$ref": "#/definitions/references::A"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
},
|
||||||
|
"references::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"$ref": "#/definitions/references::A"},
|
||||||
|
"b": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"$ref": "#/definitions/references::A"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
},
|
||||||
|
"references::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"$ref": "#/definitions/references::A"},
|
||||||
|
"b": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {"$ref": "#/definitions/references::A"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"scopes::2::X": {"type": "boolean"},
|
||||||
|
"scopes::1::Z": {"type": "string"},
|
||||||
|
"scopes::2::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": {"$ref": "#/definitions/scopes::2::X"},
|
||||||
|
"z": {"$ref": "#/definitions/scopes::1::Z"}
|
||||||
|
},
|
||||||
|
"required": ["x", "z"]
|
||||||
|
},
|
||||||
|
"scopes::3::X": {"type": "number"},
|
||||||
|
"scopes::3::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": {"$ref": "#/definitions/scopes::3::X"},
|
||||||
|
"z": {"$ref": "#/definitions/scopes::1::Z"}
|
||||||
|
},
|
||||||
|
"required": ["x", "z"]
|
||||||
|
},
|
||||||
|
"scopes::4::X": {"type": "string"},
|
||||||
|
"scopes::4::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"x": {"$ref": "#/definitions/scopes::4::X"},
|
||||||
|
"z": {"$ref": "#/definitions/scopes::1::Z"}
|
||||||
|
},
|
||||||
|
"required": ["x", "z"]
|
||||||
|
},
|
||||||
|
"scopes::1::X": {"type": "number"},
|
||||||
|
"scopes::1::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"$ref": "#/definitions/scopes::1::X"}},
|
||||||
|
"required": ["x"]
|
||||||
|
},
|
||||||
|
"scopes::X": {"type": "string"},
|
||||||
|
"scopes::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"$ref": "#/definitions/scopes::X"}},
|
||||||
|
"required": ["x"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"shadowing::1::Buffer": {"type": "object", "properties": {}},
|
||||||
|
"shadowing::1::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"y": {"$ref": "#/definitions/shadowing::1::Buffer"}},
|
||||||
|
"required": ["y"]
|
||||||
|
},
|
||||||
|
"shadowing::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"$ref": "#/definitions/Buffer"}},
|
||||||
|
"required": ["x"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"shape::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}, "y": {"type": "boolean"}},
|
||||||
|
"required": ["x", "y"]
|
||||||
|
},
|
||||||
|
"shape::Y": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"x": {"type": "string"}, "y": {"type": "boolean"}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"skipFunctions::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "string"},
|
||||||
|
"b": {"type": "boolean"},
|
||||||
|
"c": {"type": "string"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c"]
|
||||||
|
},
|
||||||
|
"skipFunctions::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "string"},
|
||||||
|
"b": {"type": "boolean"},
|
||||||
|
"c": {"type": "string"}
|
||||||
|
},
|
||||||
|
"required": ["a", "b", "c"]
|
||||||
|
},
|
||||||
|
"skipFunctions::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}, "b": {"type": "boolean"}},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"skipStatics::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"xxx": {"type": "string"}},
|
||||||
|
"required": ["xxx"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"tuples::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "array",
|
||||||
|
"items": [{"type": "string"}, {"type": "boolean"}]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"tuples::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"type": "array",
|
||||||
|
"items": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"type": "null"},
|
||||||
|
{"type": "boolean"}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"b": {
|
||||||
|
"type": "array",
|
||||||
|
"items": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"type": "null"},
|
||||||
|
{"type": "boolean"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
},
|
||||||
|
"tuples::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"type": "array", "items": [{"type": "boolean"}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"typeInMethod::Test": {"type": "object", "properties": {}},
|
||||||
|
"typeInMethod::1::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"t": {"$ref": "#/definitions/typeInMethod::Test"}},
|
||||||
|
"required": ["t"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"unions::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"type": "boolean"}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"unions::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {
|
||||||
|
"anyOf": [
|
||||||
|
{"type": "string"},
|
||||||
|
{"type": "boolean"},
|
||||||
|
{"type": "number"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"unions::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"type": "boolean"}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"unionsAndEnums::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"enum": ["one", "two"]}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"unionsAndEnums::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"enum": ["one", "two"]}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"unionsAndEnums::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"a": {"anyOf": [{"type": "string"}, {"enum": ["one", "two"]}]}
|
||||||
|
},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"valueAsType::Type": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"const": "one"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"valueAsType::Interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"const": "one"}},
|
||||||
|
"required": ["a"]
|
||||||
|
},
|
||||||
|
"valueAsType::Class": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"const": "one"}},
|
||||||
|
"required": ["a"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://json-schema.org/draft-06/schema#",
|
||||||
|
"definitions": {
|
||||||
|
"values::X": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {"a": {"type": "string"}, "b": {"type": "boolean"}},
|
||||||
|
"required": ["a", "b"]
|
||||||
|
},
|
||||||
|
"values::Y": {"anyOf": [{"type": "string"}, {"type": "boolean"}]}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue