|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
544 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | module.exports = function defFunc(ajv) {
|
|---|
| 4 | defFunc.definition = {
|
|---|
| 5 | type: 'object',
|
|---|
| 6 | macro: function (schema) {
|
|---|
| 7 | if (schema.length == 0) return true;
|
|---|
| 8 | if (schema.length == 1) return {not: {required: schema}};
|
|---|
| 9 | var schemas = schema.map(function (prop) {
|
|---|
| 10 | return {required: [prop]};
|
|---|
| 11 | });
|
|---|
| 12 | return {not: {anyOf: schemas}};
|
|---|
| 13 | },
|
|---|
| 14 | metaSchema: {
|
|---|
| 15 | type: 'array',
|
|---|
| 16 | items: {
|
|---|
| 17 | type: 'string'
|
|---|
| 18 | }
|
|---|
| 19 | }
|
|---|
| 20 | };
|
|---|
| 21 |
|
|---|
| 22 | ajv.addKeyword('prohibited', defFunc.definition);
|
|---|
| 23 | return ajv;
|
|---|
| 24 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.