Skip to content

Commit 42ff7a4

Browse files
author
Jakub Jankowski
authored
feat: redesign validations (#105)
* feat: redesign validations * fix: formatters * chore: use JSON.stringify * feat: support x-example * chore: comments * fix: fixtures * feat: bump JST and use annotations
1 parent 39fd8ba commit 42ff7a4

File tree

6 files changed

+212
-202
lines changed

6 files changed

+212
-202
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"dependencies": {
4545
"@fortawesome/free-solid-svg-icons": "^5.15.2",
4646
"@stoplight/json": "^3.10.0",
47-
"@stoplight/json-schema-tree": "^1.0.0",
47+
"@stoplight/json-schema-tree": "^1.1.0",
4848
"@stoplight/mosaic": "^1.0.0-beta.22",
4949
"@stoplight/react-error-boundary": "^1.0.0",
5050
"@stoplight/tree-list": "^5.0.3",

src/__fixtures__/default-schema.json

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,40 @@
44
"properties": {
55
"name": {
66
"type": "string",
7+
"const": "Constant name",
8+
"examples": ["Example name", "Different name"],
79
"description": "The user's full name. This description can be long and should truncate once it reaches the end of the row. If it's not truncating then theres and issue that needs to be fixed. Help!"
810
},
911
"age": {
1012
"type": "number",
11-
"minimum": 0,
12-
"maximum": 150,
13+
"minimum": 10,
14+
"maximum": 40,
1315
"multipleOf": 10,
14-
"exclusiveMinimum": true,
15-
"exclusiveMaximum": true,
16+
"default": 20,
17+
"enum": [10, 20, 30, 40],
1618
"readOnly": true
1719
},
1820
"completed_at": {
1921
"type": "string",
2022
"format": "date-time",
21-
"writeOnly": true
23+
"writeOnly": true,
24+
"pattern": "^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$"
2225
},
2326
"items": {
2427
"type": ["null", "array"],
2528
"items": {
2629
"type": ["string", "number"]
2730
},
31+
"minItems": 1,
32+
"maxItems": 4,
2833
"description": "This description can be long and should truncate once it reaches the end of the row. If it's not truncating then theres and issue that needs to be fixed. Help!"
2934
},
3035
"email": {
3136
"type": "string",
3237
"format": "email",
33-
"example": "[email protected]",
38+
"examples": ["one@email.com", "two@email.com"],
3439
"deprecated": true,
40+
"default": "[email protected]",
3541
"minLength": 2
3642
},
3743
"plan": {

0 commit comments

Comments
 (0)