main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
708 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | function getRequiredDef(keyword) {
|
---|
4 | return () => ({
|
---|
5 | keyword,
|
---|
6 | type: "object",
|
---|
7 | schemaType: "array",
|
---|
8 | macro(schema) {
|
---|
9 | if (schema.length === 0)
|
---|
10 | return true;
|
---|
11 | if (schema.length === 1)
|
---|
12 | return { required: schema };
|
---|
13 | const comb = keyword === "anyRequired" ? "anyOf" : "oneOf";
|
---|
14 | return { [comb]: schema.map((p) => ({ required: [p] })) };
|
---|
15 | },
|
---|
16 | metaSchema: {
|
---|
17 | type: "array",
|
---|
18 | items: { type: "string" },
|
---|
19 | },
|
---|
20 | });
|
---|
21 | }
|
---|
22 | exports.default = getRequiredDef;
|
---|
23 | //# sourceMappingURL=_required.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.