Skip to content

Commit c61d16a

Browse files
committed
Add missing hover descriptions
1 parent c6ae4a9 commit c61d16a

File tree

10 files changed

+71
-39
lines changed

10 files changed

+71
-39
lines changed

draft-04/additionalItems.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,6 @@ const collectEvaluatedItems = (keywordValue, instance, ast, dynamicAnchors) => {
3939
return evaluatedIndexes;
4040
};
4141

42-
export default { id, compile, interpret, collectEvaluatedItems };
42+
const description = "If items is set to an array of schemas, validation succeeds if each element of the instance not covered by it validates against this schema. Read more: https://www.learnjsonschema.com/2019-09/applicator/additionalItems/";
43+
44+
export default { id, compile, interpret, collectEvaluatedItems, description };

draft-04/dependencies.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,6 @@ const interpret = (dependencies, instance, ast, dynamicAnchors, quiet) => {
3131
});
3232
};
3333

34-
export default { id, compile, interpret };
34+
const description = "If the object values are objects, this keyword specifies subschemas that are evaluated if the instance is an object and contains a certain property. If the object values are arrays, validation succeeds if, for each name that appears in both the instance and as a name within this keyword’s value, every item in the corresponding array is also the name of a property in the instance.";
35+
36+
export default { id, compile, interpret, description };

draft-04/exclusiveMaximum.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const id = "https://json-schema.org/keyword/draft-04/exclusiveMaximum";
22
const compile = (schema) => schema.value;
33
const interpret = () => true;
4+
const description = "Modifies the maximum keyword to succeed if the numberic instance is less than, but not equal to, the given number";
45

5-
export default { id, compile, interpret };
6+
export default { id, compile, interpret, description };

draft-04/exclusiveMinimum.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const id = "https://json-schema.org/keyword/draft-04/exclusiveMinimum";
22
const compile = (schema) => schema.value;
33
const interpret = () => true;
4+
const description = "Modifies the minimum keyword to succeed if the numberic instance is greater than, but not equal to, the given number";
45

5-
export default { id, compile, interpret };
6+
export default { id, compile, interpret, description };

draft-04/id.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
export default { id: "https://json-schema.org/keyword/draft-04/id" };
1+
export default {
2+
id: "https://json-schema.org/keyword/draft-04/id",
3+
description: "This keyword declares an identifier for the schema resource."
4+
};

draft-04/items.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ const collectEvaluatedItems = (items, instance, ast, dynamicAnchors) => {
4040
: collectSet(range(0, items.length)));
4141
};
4242

43-
export default { id, compile, interpret, collectEvaluatedItems };
43+
const description = "If set to a schema, validation succeeds if each element of the instance validates against it, otherwise validation succeeds if each element of the instance validates against the schema at the same position, if any.";
44+
45+
export default { id, compile, interpret, collectEvaluatedItems, description };

draft-04/maximum.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ const interpret = ([maximum, isExclusive], instance) => {
2222
return isExclusive ? value < maximum : value <= maximum;
2323
};
2424

25-
export default { id, compile, interpret };
25+
const description = "Validation succeeds if the numeric instance is less than or equal to the given number. The behavior of this keyword is modified by the exclusiveMaximum keyword.";
26+
27+
export default { id, compile, interpret, description };

draft-04/minimum.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,6 @@ const interpret = ([minimum, isExclusive], instance) => {
2222
return isExclusive ? value > minimum : value >= minimum;
2323
};
2424

25-
export default { id, compile, interpret };
25+
const description = "Validation succeeds if the numeric instance is greater than or equal to the given number. The behavior of this keyword is modified by the exclusiveMinimum keyword.";
26+
27+
export default { id, compile, interpret, description };

draft-04/ref.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
export default { id: "https://json-schema.org/keyword/draft-04/ref" };
1+
export default {
2+
id: "https://json-schema.org/keyword/draft-04/ref",
3+
description: "This keyword is used to reference a statically identified schema."
4+
};

draft-04/schema.js

Lines changed: 44 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
1-
import items from "../lib/keywords/items.js";
1+
import id from "../draft-04/id.js";
2+
import title from "../lib/keywords/title.js";
3+
import description from "../lib/keywords/description.js";
4+
import _default from "../lib/keywords/default.js";
5+
import multipleOf from "../lib/keywords/multipleOf.js";
6+
import maximum from "./maximum.js";
7+
import exclusiveMaximum from "./exclusiveMaximum.js";
8+
import minimum from "./minimum.js";
9+
import exclusiveMinimum from "./exclusiveMinimum.js";
10+
import maxLength from "../lib/keywords/maxLength.js";
11+
import minLength from "../lib/keywords/minLength.js";
12+
import pattern from "../lib/keywords/pattern.js";
13+
import additionalItems from "./additionalItems.js";
14+
import items from "./items.js";
15+
import maxItems from "../lib/keywords/maxItems.js";
16+
import minItems from "../lib/keywords/minItems.js";
17+
import uniqueItems from "../lib/keywords/uniqueItems.js";
18+
import maxProperties from "../lib/keywords/maxProperties.js";
19+
import minProperties from "../lib/keywords/minProperties.js";
20+
import required from "../lib/keywords/required.js";
221
import additionalProperties from "../lib/keywords/additionalProperties.js";
22+
import definitions from "../lib/keywords/definitions.js";
323
import properties from "../lib/keywords/properties.js";
424
import patternProperties from "../lib/keywords/patternProperties.js";
25+
import dependencies from "./dependencies.js";
26+
import _enum from "../lib/keywords/enum.js";
27+
import _type from "../lib/keywords/type.js";
28+
import format from "../lib/keywords/format.js";
529
import allOf from "../lib/keywords/allOf.js";
630
import anyOf from "../lib/keywords/anyOf.js";
731
import oneOf from "../lib/keywords/oneOf.js";
832
import not from "../lib/keywords/not.js";
9-
import typeKeyword from "../lib/keywords/type.js";
10-
import enumKeyword from "../lib/keywords/enum.js";
11-
import pattern from "../lib/keywords/pattern.js";
12-
import minLength from "../lib/keywords/minLength.js";
13-
import maxLength from "../lib/keywords/maxLength.js";
14-
import exclusiveMaximum from "../lib/keywords/exclusiveMaximum.js";
15-
import multipleOf from "../lib/keywords/multipleOf.js";
16-
import exclusiveMinimum from "../lib/keywords/exclusiveMinimum.js";
17-
import maximum from "../lib/keywords/maximum.js";
18-
import minimum from "../lib/keywords/minimum.js";
19-
import maxProperties from "../lib/keywords/maxProperties.js";
20-
import minProperties from "../lib/keywords/minProperties.js";
21-
import required from "../lib/keywords/required.js";
22-
import maxItems from "../lib/keywords/maxItems.js";
23-
import minItems from "../lib/keywords/minItems.js";
24-
import uniqueItems from "../lib/keywords/uniqueItems.js";
25-
import title from "../lib/keywords/title.js";
26-
import description from "../lib/keywords/description.js";
27-
import format from "../lib/keywords/format.js";
2833

2934

3035
export default {
@@ -57,10 +62,14 @@ export default {
5762
"type": "object",
5863
"properties": {
5964
"id": {
60-
"type": "string"
65+
"type": "string",
66+
"description": id.description
6167
},
6268
"$schema": {
63-
"type": "string"
69+
"type": "string",
70+
"description": `This keyword is both used as a JSON Schema dialect \
71+
identifier and as a reference to a JSON Schema which describes the set \
72+
of valid schemas written for this particular dialect.`
6473
},
6574
"title": {
6675
"type": "string",
@@ -70,7 +79,9 @@ export default {
7079
"type": "string",
7180
"description": description.description
7281
},
73-
"default": {},
82+
"default": {
83+
"description": _default.description
84+
},
7485
"multipleOf": {
7586
"type": "number",
7687
"minimum": 0,
@@ -113,7 +124,8 @@ export default {
113124
{ "type": "boolean" },
114125
{ "$ref": "#" }
115126
],
116-
"default": {}
127+
"default": {},
128+
"description": additionalItems.description
117129
},
118130
"items": {
119131
"anyOf": [
@@ -160,7 +172,8 @@ export default {
160172
"definitions": {
161173
"type": "object",
162174
"additionalProperties": { "$ref": "#" },
163-
"default": {}
175+
"default": {},
176+
"description": definitions.description
164177
},
165178
"properties": {
166179
"type": "object",
@@ -181,13 +194,14 @@ export default {
181194
{ "$ref": "#" },
182195
{ "$ref": "#/definitions/stringArray" }
183196
]
184-
}
197+
},
198+
"description": dependencies.description
185199
},
186200
"enum": {
187201
"type": "array",
188202
"minItems": 1,
189203
"uniqueItems": true,
190-
"description": enumKeyword.description
204+
"description": _enum.description
191205
},
192206
"type": {
193207
"anyOf": [
@@ -199,19 +213,19 @@ export default {
199213
"uniqueItems": true
200214
}
201215
],
202-
"description": typeKeyword.description
216+
"description": _type.description
203217
},
204218
"format": { "type": "string", "description": format.description },
205219
"allOf": {
206220
"allOf": [{ "$ref": "#/definitions/schemaArray" }],
207221
"description": allOf.description
208222
},
209223
"anyOf": {
210-
"anyOf": [{ "$ref": "#/definitions/schemaArray" }],
224+
"allOf": [{ "$ref": "#/definitions/schemaArray" }],
211225
"description": anyOf.description
212226
},
213227
"oneOf": {
214-
"oneOf": [{ "$ref": "#/definitions/schemaArray" }],
228+
"allOf": [{ "$ref": "#/definitions/schemaArray" }],
215229
"description": oneOf.description
216230
},
217231
"not": {

0 commit comments

Comments
 (0)