main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
520 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | import type {MacroKeywordDefinition} from "ajv"
|
---|
| 2 |
|
---|
| 3 | export default function getDef(): MacroKeywordDefinition {
|
---|
| 4 | return {
|
---|
| 5 | keyword: "prohibited",
|
---|
| 6 | type: "object",
|
---|
| 7 | schemaType: "array",
|
---|
| 8 | macro: function (schema: string[]) {
|
---|
| 9 | if (schema.length === 0) return true
|
---|
| 10 | if (schema.length === 1) return {not: {required: schema}}
|
---|
| 11 | return {not: {anyOf: schema.map((p) => ({required: [p]}))}}
|
---|
| 12 | },
|
---|
| 13 | metaSchema: {
|
---|
| 14 | type: "array",
|
---|
| 15 | items: {type: "string"},
|
---|
| 16 | },
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | module.exports = getDef
|
---|
Note:
See
TracBrowser
for help on using the repository browser.