-
-
Notifications
You must be signed in to change notification settings - Fork 154
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 #157 from jousepo/master
Added #draft-6 examples json-schema support in string, number, integer and array items
- Loading branch information
Showing
4 changed files
with
35 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const id = 'example-values' | ||
|
||
const title = 'Example values' | ||
|
||
const description = `The \`example\` keyword from JSON schema is used to suggest values in a "string", "number", "integer" or "array" but is not required as the "enum" keyword.` | ||
|
||
const schema = { | ||
type: 'object', | ||
properties: { | ||
stringProp: { type: 'string', title: `I'm a string with some examples`, default: `I'm a default value`, examples: [`I'm a suggested value`, `Hey!!! I'm another suggestion`] }, | ||
numberProp: { type: 'number', title: `I'm a number with some examples`, default: 1, examples: [11, 22, 33, 44, 55] }, | ||
stringArrayProp: { type: 'array', title: `I'm an array of strings with some examples`, items: { type: 'string' }, examples: [`I'm a suggested value`, `Hey!!! I'm another suggestion`] }, | ||
numberArrayProp: { type: 'array', title: `I'm an array of numbers with some examples`, items: { type: 'number' }, examples: [1, 2, 3, 4, 5] } | ||
} | ||
} | ||
|
||
const model = {} | ||
|
||
export default { id, title, description, schema, model } |
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