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 |
|
\ | No newline at end of file |