diff --git a/examples/docs/README.md b/examples/docs/README.md index 8ca78abfaf3c853cdd48f17feb521c1813a9a3c3..8b904f2a00a373e66b43a78958fca76c36c9bfb2 100644 --- a/examples/docs/README.md +++ b/examples/docs/README.md @@ -7,6 +7,7 @@ ## / * [Definitions](./definitions.schema.md) – `https://example.com/schemas/definitions` +* [Example](./example.schema.md) – `https://example.com/schemas/example` * [Simple](./simple.schema.md) – `https://example.com/schemas/simple` ## /subdir/ diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 5e14172d87167d1728c245060336a55e472d8ee0..90efcdd0ae8388acf0aba4064810b4a8c0ac1813 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -13,15 +13,15 @@ It is imported using `allOf` and `$ref`. +## Properties - -## content -### Properties - -### id +### id +* **Required** * **Type:** string * **Format:** uri A unique identifier given to every addressable thing. + + diff --git a/examples/docs/example.schema.md b/examples/docs/example.schema.md new file mode 100644 index 0000000000000000000000000000000000000000..5f34caedd324891a2b055a68583ae2dc95931474 --- /dev/null +++ b/examples/docs/example.schema.md @@ -0,0 +1,37 @@ + + + + +# Example + + +* **Type:** object + +This is an example schema with examples. Too many examples? There can never be too many examples! + +**Examples:** +```json +{ + "foo": "bar", + "bar": "baz" +} +``` + + + + +## Properties + + +### foo +* **Type:** string + + A simple string. + +### bar +* **Type:** string + + A simple string. + + + diff --git a/examples/generated-schemas/definitions.schema.json b/examples/generated-schemas/definitions.schema.json index aed499a7b6cc260567c42407f5b1dda2bc6df028..e916a3a43fda619ee22d7f9a78359fdaaea2e1af 100644 --- a/examples/generated-schemas/definitions.schema.json +++ b/examples/generated-schemas/definitions.schema.json @@ -10,7 +10,7 @@ "title": "Definitions", "type": "object", "definitions": { - "content": { + "myid": { "properties": { "id": { "type": "string", @@ -22,8 +22,11 @@ }, "allOf": [ { - "$ref": "#/definitions/id" + "$ref": "#/definitions/myid" } ], + "required": [ + "id" + ], "description": "This is an example of using a `definitions` object within a schema.\n\nIt is imported using `allOf` and `$ref`." } \ No newline at end of file diff --git a/examples/generated-schemas/example.schema.json b/examples/generated-schemas/example.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..20095918cd5d750561144b146691b6b00b3e7213 --- /dev/null +++ b/examples/generated-schemas/example.schema.json @@ -0,0 +1,34 @@ +{ + "meta:license": [ + "Copyright 2017 Adobe Systems Incorporated. All rights reserved.", + "This file is licensed to you under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License. You may obtain a copy", + "of the License at http://www.apache.org/licenses/LICENSE-2.0" + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://example.com/schemas/example", + "title": "Example", + "type": "object", + "description": "This is an example schema with examples. Too many examples? There can never be too many examples!", + "properties": { + "foo": { + "type": "string", + "description": "A simple string.", + "meta:example": "bar" + }, + "bar": { + "type": "string", + "description": "A simple string.", + "meta:example": [ + "bar", + "baz" + ] + } + }, + "examples": [ + { + "foo": "bar", + "bar": "baz" + } + ] +} \ No newline at end of file diff --git a/examples/generated-schemas/simple.schema.json b/examples/generated-schemas/simple.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..e49f5d6f02173dd288acb2d041a9df350ccbc287 --- /dev/null +++ b/examples/generated-schemas/simple.schema.json @@ -0,0 +1,25 @@ +{ + "meta:license": [ + "Copyright 2017 Adobe Systems Incorporated. All rights reserved.", + "This file is licensed to you under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License. You may obtain a copy", + "of the License at http://www.apache.org/licenses/LICENSE-2.0" + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://example.com/schemas/simple", + "title": "Simple", + "description": "This is a *very* simple example of a JSON schema. There is only one property.", + "type": "object", + "allOf": [ + { + "$ref": "#/definitions/id" + } + ], + "properties": { + "id": { + "type": "string", + "format": "uri", + "description": "A unique identifier given to every addressable thing." + } + } +} \ No newline at end of file diff --git a/examples/generated-schemas/subdir/subdir.schema.json b/examples/generated-schemas/subdir/subdir.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..c2009a241546b96d83bae7a3510123a5ecd5ea78 --- /dev/null +++ b/examples/generated-schemas/subdir/subdir.schema.json @@ -0,0 +1,29 @@ +{ + "meta:license": [ + "Copyright 2017 Adobe Systems Incorporated. All rights reserved.", + "This file is licensed to you under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License. You may obtain a copy", + "of the License at http://www.apache.org/licenses/LICENSE-2.0" + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://example.com/schemas/subdir/subdir", + "title": "Subdir", + "type": "object", + "description": "A schema in a sub directory", + "definitions": { + "content": { + "properties": { + "id": { + "type": "string", + "format": "uri", + "description": "A unique identifier given to every addressable thing." + } + } + } + }, + "allOf": [ + { + "$ref": "#/definitions/id" + } + ] +} \ No newline at end of file diff --git a/examples/schemas/definitions.schema.json b/examples/schemas/definitions.schema.json index bb728116bbf60a27d795ee5dd79974e6002ad1a8..64e3fa98a6933ecf06bc96e6d8540bcc5aef3216 100644 --- a/examples/schemas/definitions.schema.json +++ b/examples/schemas/definitions.schema.json @@ -10,7 +10,7 @@ "title": "Definitions", "type": "object", "definitions": { - "content": { + "myid": { "properties": { "id": { "type": "string", @@ -21,6 +21,9 @@ } }, "allOf": [ - {"$ref": "#/definitions/id"} + {"$ref": "#/definitions/myid"} + ], + "required": [ + "id" ] } diff --git a/examples/schemas/example.example.1.json b/examples/schemas/example.example.1.json new file mode 100644 index 0000000000000000000000000000000000000000..7cdaab9ed14a5d05519fe24b93a06799208c54f9 --- /dev/null +++ b/examples/schemas/example.example.1.json @@ -0,0 +1,4 @@ +{ + "foo": "bar", + "bar": "baz" +} \ No newline at end of file diff --git a/examples/schemas/example.schema.json b/examples/schemas/example.schema.json new file mode 100644 index 0000000000000000000000000000000000000000..af47ed210f8b7d3d2866f1cc2b03df1568f81a11 --- /dev/null +++ b/examples/schemas/example.schema.json @@ -0,0 +1,25 @@ +{ + "meta:license": [ + "Copyright 2017 Adobe Systems Incorporated. All rights reserved.", + "This file is licensed to you under the Apache License, Version 2.0 (the 'License');", + "you may not use this file except in compliance with the License. You may obtain a copy", + "of the License at http://www.apache.org/licenses/LICENSE-2.0" + ], + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "https://example.com/schemas/example", + "title": "Example", + "type": "object", + "description": "This is an example schema with examples. Too many examples? There can never be too many examples!", + "properties": { + "foo": { + "type": "string", + "description": "A simple string.", + "meta:example": "bar" + }, + "bar": { + "type": "string", + "description": "A simple string.", + "meta:example": ["bar", "baz"] + } + } +}