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:
469 bytes
|
Line | |
---|
1 | import type {MacroKeywordDefinition} from "ajv"
|
---|
2 |
|
---|
3 | export default function getDef(): MacroKeywordDefinition {
|
---|
4 | return {
|
---|
5 | keyword: "allRequired",
|
---|
6 | type: "object",
|
---|
7 | schemaType: "boolean",
|
---|
8 | macro(schema: boolean, parentSchema) {
|
---|
9 | if (!schema) return true
|
---|
10 | const required = Object.keys(parentSchema.properties)
|
---|
11 | if (required.length === 0) return true
|
---|
12 | return {required}
|
---|
13 | },
|
---|
14 | dependencies: ["properties"],
|
---|
15 | }
|
---|
16 | }
|
---|
17 |
|
---|
18 | module.exports = getDef
|
---|
Note:
See
TracBrowser
for help on using the repository browser.