Skip to content
Snippets Groups Projects
Commit 6e1c6598 authored by Lars Trieloff's avatar Lars Trieloff
Browse files

[trivial] provide an example of embedded examples

parent 3e6e1b00
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
## / ## /
* [Definitions](./definitions.schema.md)`https://example.com/schemas/definitions` * [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` * [Simple](./simple.schema.md)`https://example.com/schemas/simple`
## /subdir/ ## /subdir/
......
...@@ -13,15 +13,15 @@ It is imported using `allOf` and `$ref`. ...@@ -13,15 +13,15 @@ It is imported using `allOf` and `$ref`.
## Properties
### id
## content * **Required**
### Properties
### id
* **Type:** string * **Type:** string
* **Format:** uri * **Format:** uri
A unique identifier given to every addressable thing. A unique identifier given to every addressable thing.
# 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.
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"title": "Definitions", "title": "Definitions",
"type": "object", "type": "object",
"definitions": { "definitions": {
"content": { "myid": {
"properties": { "properties": {
"id": { "id": {
"type": "string", "type": "string",
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
}, },
"allOf": [ "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`." "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
{
"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
{
"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
{
"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
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"title": "Definitions", "title": "Definitions",
"type": "object", "type": "object",
"definitions": { "definitions": {
"content": { "myid": {
"properties": { "properties": {
"id": { "id": {
"type": "string", "type": "string",
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
} }
}, },
"allOf": [ "allOf": [
{"$ref": "#/definitions/id"} {"$ref": "#/definitions/myid"}
],
"required": [
"id"
] ]
} }
{
"foo": "bar",
"bar": "baz"
}
\ No newline at end of file
{
"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"]
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment