@fincity/kirun-js 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +9 -0
- package/__tests__/engine/function/system/array/AddFirstTest.ts +235 -0
- package/__tests__/engine/function/system/array/AddTest.ts +126 -0
- package/__tests__/engine/function/system/array/BinarySearchTest.ts +135 -0
- package/__tests__/engine/function/system/array/CompareTest.ts +48 -0
- package/__tests__/engine/function/system/array/CopyTest.ts +86 -0
- package/__tests__/engine/function/system/array/DeleteFirstTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteFromTest.ts +232 -0
- package/__tests__/engine/function/system/array/DeleteLastTest.ts +103 -0
- package/__tests__/engine/function/system/array/DeleteTest.ts +110 -0
- package/__tests__/engine/function/system/array/DisjointTest.ts +184 -0
- package/__tests__/engine/function/system/array/Equals.ts +67 -0
- package/__tests__/engine/function/system/array/FillTest.ts +36 -0
- package/__tests__/engine/function/system/array/FrequencyTest.ts +97 -0
- package/__tests__/engine/function/system/array/IndexOfArrayTest.ts +347 -0
- package/__tests__/engine/function/system/array/IndexOfTest.ts +267 -0
- package/__tests__/engine/function/system/array/InsertTest.ts +229 -0
- package/__tests__/engine/function/system/array/LastIndexOfArrayTest.ts +213 -0
- package/__tests__/engine/function/system/array/LastIndexOfTest.ts +253 -0
- package/__tests__/engine/function/system/array/MaxTest.ts +98 -0
- package/__tests__/engine/function/system/array/MinTest.ts +99 -0
- package/__tests__/engine/function/system/array/MisMatchTest.ts +215 -0
- package/__tests__/engine/function/system/array/ReverseTest.ts +235 -0
- package/__tests__/engine/function/system/array/RotateTest.ts +137 -0
- package/__tests__/engine/function/system/array/ShuffleTest.ts +154 -0
- package/__tests__/engine/function/system/array/SortTest.ts +130 -0
- package/__tests__/engine/function/system/array/SubArrayTest.ts +236 -0
- package/__tests__/engine/function/system/math/AddTest.ts +12 -0
- package/__tests__/engine/function/system/string/ConcatenateTest.ts +46 -0
- package/__tests__/engine/function/system/string/DeleteForGivenLengthTest.ts +38 -0
- package/__tests__/engine/function/system/string/InsertAtGivenPositionTest.ts +53 -0
- package/__tests__/engine/function/system/string/PostPadTest.ts +54 -0
- package/__tests__/engine/function/system/string/PrePadTest.ts +54 -0
- package/__tests__/engine/function/system/string/RegionMatchesTest.ts +78 -0
- package/__tests__/engine/function/system/string/ReverseTest.ts +36 -0
- package/__tests__/engine/function/system/string/SplitTest.ts +61 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest2.ts +126 -0
- package/__tests__/engine/function/system/string/StringFunctionRepoTest3.ts +54 -0
- package/__tests__/engine/function/system/string/StringFunctionRepositoryTest.ts +146 -0
- package/__tests__/engine/function/system/string/ToStringTest.ts +43 -0
- package/__tests__/engine/function/system/string/TrimToTest.ts +28 -0
- package/__tests__/engine/json/schema/validator/SchemaValidatorTest.ts +26 -0
- package/__tests__/engine/runtime/KIRuntimeTest.ts +351 -0
- package/__tests__/engine/runtime/expression/ExpressionEvaluationTest.ts +128 -0
- package/__tests__/engine/runtime/expression/ExpressionTest.ts +33 -0
- package/__tests__/engine/runtime/expression/tokenextractor/OutputMapTokenValueExtractorTest.ts +44 -0
- package/__tests__/engine/runtime/expression/tokenextractor/TokenValueExtractorTest.ts +72 -0
- package/__tests__/engine/util/LinkedListTest.ts +29 -0
- package/__tests__/engine/util/string/StringFormatterTest.ts +17 -0
- package/__tests__/indexTest.ts +33 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/module.js +2 -0
- package/dist/module.js.map +1 -0
- package/dist/types.d.ts +430 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +54 -0
- package/src/engine/HybridRepository.ts +18 -0
- package/src/engine/Repository.ts +3 -0
- package/src/engine/constant/KIRunConstants.ts +7 -0
- package/src/engine/exception/ExecutionException.ts +12 -0
- package/src/engine/exception/KIRuntimeException.ts +12 -0
- package/src/engine/function/AbstractFunction.ts +76 -0
- package/src/engine/function/Function.ts +13 -0
- package/src/engine/function/system/GenerateEvent.ts +76 -0
- package/src/engine/function/system/If.ts +40 -0
- package/src/engine/function/system/array/AbstractArrayFunction.ts +158 -0
- package/src/engine/function/system/array/Add.ts +31 -0
- package/src/engine/function/system/array/AddFirst.ts +44 -0
- package/src/engine/function/system/array/BinarySearch.ts +66 -0
- package/src/engine/function/system/array/Compare.ts +150 -0
- package/src/engine/function/system/array/Copy.ts +56 -0
- package/src/engine/function/system/array/Delete.ts +63 -0
- package/src/engine/function/system/array/DeleteFirst.ts +22 -0
- package/src/engine/function/system/array/DeleteFrom.ts +51 -0
- package/src/engine/function/system/array/DeleteLast.ts +23 -0
- package/src/engine/function/system/array/Disjoint.ts +85 -0
- package/src/engine/function/system/array/Equals.ts +36 -0
- package/src/engine/function/system/array/Fill.ts +51 -0
- package/src/engine/function/system/array/Frequency.ts +68 -0
- package/src/engine/function/system/array/IndexOf.ts +56 -0
- package/src/engine/function/system/array/IndexOfArray.ts +67 -0
- package/src/engine/function/system/array/Insert.ts +48 -0
- package/src/engine/function/system/array/LastIndexOf.ts +62 -0
- package/src/engine/function/system/array/LastIndexOfArray.ts +70 -0
- package/src/engine/function/system/array/Max.ts +31 -0
- package/src/engine/function/system/array/Min.ts +32 -0
- package/src/engine/function/system/array/MisMatch.ts +66 -0
- package/src/engine/function/system/array/Reverse.ts +50 -0
- package/src/engine/function/system/array/Rotate.ts +43 -0
- package/src/engine/function/system/array/Shuffle.ts +31 -0
- package/src/engine/function/system/array/Sort.ts +70 -0
- package/src/engine/function/system/array/SubArray.ts +48 -0
- package/src/engine/function/system/context/Create.ts +73 -0
- package/src/engine/function/system/context/Get.ts +55 -0
- package/src/engine/function/system/context/SetFunction.ts +244 -0
- package/src/engine/function/system/loop/CountLoop.ts +55 -0
- package/src/engine/function/system/loop/RangeLoop.ts +120 -0
- package/src/engine/function/system/math/Add.ts +34 -0
- package/src/engine/function/system/math/GenericMathFunction.ts +80 -0
- package/src/engine/function/system/math/Hypotenuse.ts +57 -0
- package/src/engine/function/system/math/MathFunctionRepository.ts +63 -0
- package/src/engine/function/system/math/Maximum.ts +38 -0
- package/src/engine/function/system/math/Minimum.ts +38 -0
- package/src/engine/function/system/math/Random.ts +27 -0
- package/src/engine/function/system/string/AbstractStringFunction.ts +409 -0
- package/src/engine/function/system/string/Concatenate.ts +57 -0
- package/src/engine/function/system/string/DeleteForGivenLength.ts +82 -0
- package/src/engine/function/system/string/InsertAtGivenPosition.ts +72 -0
- package/src/engine/function/system/string/PostPad.ts +83 -0
- package/src/engine/function/system/string/PrePad.ts +73 -0
- package/src/engine/function/system/string/RegionMatches.ts +119 -0
- package/src/engine/function/system/string/ReplaceAtGivenPosition.ts +101 -0
- package/src/engine/function/system/string/Reverse.ts +62 -0
- package/src/engine/function/system/string/Split.ts +53 -0
- package/src/engine/function/system/string/StringFunctionRepository.ts +60 -0
- package/src/engine/function/system/string/ToString.ts +45 -0
- package/src/engine/function/system/string/TrimTo.ts +55 -0
- package/src/engine/json/JsonExpression.ts +11 -0
- package/src/engine/json/schema/Schema.ts +670 -0
- package/src/engine/json/schema/SchemaUtil.ts +145 -0
- package/src/engine/json/schema/array/ArraySchemaType.ts +44 -0
- package/src/engine/json/schema/object/AdditionalPropertiesType.ts +32 -0
- package/src/engine/json/schema/string/StringFormat.ts +7 -0
- package/src/engine/json/schema/type/MultipleType.ts +28 -0
- package/src/engine/json/schema/type/SchemaType.ts +11 -0
- package/src/engine/json/schema/type/SingleType.ts +23 -0
- package/src/engine/json/schema/type/Type.ts +6 -0
- package/src/engine/json/schema/type/TypeUtil.ts +25 -0
- package/src/engine/json/schema/validator/AnyOfAllOfOneOfValidator.ts +108 -0
- package/src/engine/json/schema/validator/ArrayValidator.ts +145 -0
- package/src/engine/json/schema/validator/BooleanValidator.ts +24 -0
- package/src/engine/json/schema/validator/NullValidator.ts +17 -0
- package/src/engine/json/schema/validator/NumberValidator.ts +115 -0
- package/src/engine/json/schema/validator/ObjectValidator.ts +184 -0
- package/src/engine/json/schema/validator/SchemaValidator.ts +141 -0
- package/src/engine/json/schema/validator/StringValidator.ts +97 -0
- package/src/engine/json/schema/validator/TypeValidator.ts +49 -0
- package/src/engine/json/schema/validator/exception/SchemaReferenceException.ts +19 -0
- package/src/engine/json/schema/validator/exception/SchemaValidationException.ts +22 -0
- package/src/engine/model/AbstractStatement.ts +29 -0
- package/src/engine/model/Argument.ts +36 -0
- package/src/engine/model/Event.ts +62 -0
- package/src/engine/model/EventResult.ts +34 -0
- package/src/engine/model/FunctionDefinition.ts +69 -0
- package/src/engine/model/FunctionOutput.ts +37 -0
- package/src/engine/model/FunctionOutputGenerator.ts +5 -0
- package/src/engine/model/FunctionSignature.ts +67 -0
- package/src/engine/model/Parameter.ts +97 -0
- package/src/engine/model/ParameterReference.ts +57 -0
- package/src/engine/model/ParameterReferenceType.ts +4 -0
- package/src/engine/model/ParameterType.ts +4 -0
- package/src/engine/model/Position.ts +40 -0
- package/src/engine/model/Statement.ts +101 -0
- package/src/engine/model/StatementGroup.ts +37 -0
- package/src/engine/namespaces/Namespaces.ts +11 -0
- package/src/engine/repository/KIRunFunctionRepository.ts +37 -0
- package/src/engine/repository/KIRunSchemaRepository.ts +24 -0
- package/src/engine/runtime/ContextElement.ts +28 -0
- package/src/engine/runtime/FunctionExecutionParameters.ts +74 -0
- package/src/engine/runtime/KIRuntime.ts +653 -0
- package/src/engine/runtime/StatementExecution.ts +61 -0
- package/src/engine/runtime/StatementMessage.ts +30 -0
- package/src/engine/runtime/StatementMessageType.ts +5 -0
- package/src/engine/runtime/expression/Expression.ts +330 -0
- package/src/engine/runtime/expression/ExpressionEvaluator.ts +305 -0
- package/src/engine/runtime/expression/ExpressionToken.ts +15 -0
- package/src/engine/runtime/expression/ExpressionTokenValue.ts +23 -0
- package/src/engine/runtime/expression/Operation.ts +190 -0
- package/src/engine/runtime/expression/exception/ExpressionEvaluationException.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticAdditionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticInetgerDivisionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticModulusOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticMultiplicationOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArithmeticSubtractionOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/ArrayOperator.ts +31 -0
- package/src/engine/runtime/expression/operators/binary/BinaryOperator.ts +15 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseAndOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseLeftShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseOrOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseUnsignedRightShiftOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/BitwiseXorOperator.ts +9 -0
- package/src/engine/runtime/expression/operators/binary/LogicalAndOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/LogicalEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalGreaterThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanEqualOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalLessThanOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/binary/LogicalNotEqualOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/binary/LogicalOrOperator.ts +25 -0
- package/src/engine/runtime/expression/operators/binary/ObjectOperator.ts +24 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryMinusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/ArithmeticUnaryPlusOperator.ts +13 -0
- package/src/engine/runtime/expression/operators/unary/BitwiseComplementOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/LogicalNotOperator.ts +22 -0
- package/src/engine/runtime/expression/operators/unary/UnaryOperator.ts +15 -0
- package/src/engine/runtime/expression/tokenextractor/LiteralTokenValueExtractor.ts +64 -0
- package/src/engine/runtime/expression/tokenextractor/TokenValueExtractor.ts +136 -0
- package/src/engine/runtime/graph/ExecutionGraph.ts +81 -0
- package/src/engine/runtime/graph/GraphVertex.ts +118 -0
- package/src/engine/runtime/graph/GraphVertexType.ts +4 -0
- package/src/engine/runtime/tokenextractor/ArgumentsTokenValueExtractor.ts +22 -0
- package/src/engine/runtime/tokenextractor/ContextTokenValueExtractor.ts +37 -0
- package/src/engine/runtime/tokenextractor/OutputMapTokenValueExtractor.ts +32 -0
- package/src/engine/util/ArrayUtil.ts +23 -0
- package/src/engine/util/LinkedList.ts +229 -0
- package/src/engine/util/MapUtil.ts +86 -0
- package/src/engine/util/NullCheck.ts +3 -0
- package/src/engine/util/Tuples.ts +43 -0
- package/src/engine/util/primitive/PrimitiveUtil.ts +143 -0
- package/src/engine/util/string/StringBuilder.ts +59 -0
- package/src/engine/util/string/StringFormatter.ts +25 -0
- package/src/engine/util/string/StringUtil.ts +48 -0
- package/src/index.ts +13 -0
- package/tsconfig.json +6 -0
|
@@ -0,0 +1,670 @@
|
|
|
1
|
+
import { Namespaces } from '../../namespaces/Namespaces';
|
|
2
|
+
import { ArraySchemaType } from './array/ArraySchemaType';
|
|
3
|
+
import { AdditionalPropertiesType } from './object/AdditionalPropertiesType';
|
|
4
|
+
import { StringFormat } from './string/StringFormat';
|
|
5
|
+
import { SchemaType } from './type/SchemaType';
|
|
6
|
+
import { TypeUtil } from './type/TypeUtil';
|
|
7
|
+
import { Type } from './type/Type';
|
|
8
|
+
import { isNullValue } from '../../util/NullCheck';
|
|
9
|
+
import { SingleType } from './type/SingleType';
|
|
10
|
+
|
|
11
|
+
const ADDITIONAL_PROPERTY: string = 'additionalProperty';
|
|
12
|
+
const ENUMS: string = 'enums';
|
|
13
|
+
const ITEMS_STRING: string = 'items';
|
|
14
|
+
const SCHEMA_ROOT_PATH: string = '#/';
|
|
15
|
+
const REQUIRED_STRING: string = 'required';
|
|
16
|
+
const VERSION_STRING: string = 'version';
|
|
17
|
+
const NAMESPACE_STRING: string = 'namespace';
|
|
18
|
+
const TEMPORARY: string = '_';
|
|
19
|
+
|
|
20
|
+
export class Schema {
|
|
21
|
+
public static readonly NULL: Schema = new Schema()
|
|
22
|
+
.setNamespace(Namespaces.SYSTEM)
|
|
23
|
+
.setName('Null')
|
|
24
|
+
.setType(TypeUtil.of(SchemaType.NULL))
|
|
25
|
+
.setConstant(undefined);
|
|
26
|
+
|
|
27
|
+
private static readonly TYPE_SCHEMA: Schema = new Schema()
|
|
28
|
+
.setType(TypeUtil.of(SchemaType.STRING))
|
|
29
|
+
.setEnums([
|
|
30
|
+
'INTEGER',
|
|
31
|
+
'LONG',
|
|
32
|
+
'FLOAT',
|
|
33
|
+
'DOUBLE',
|
|
34
|
+
'STRING',
|
|
35
|
+
'OBJECT',
|
|
36
|
+
'ARRAY',
|
|
37
|
+
'BOOLEAN',
|
|
38
|
+
'NULL',
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
public static readonly SCHEMA: Schema = new Schema()
|
|
42
|
+
.setNamespace(Namespaces.SYSTEM)
|
|
43
|
+
.setName('Schema')
|
|
44
|
+
.setType(TypeUtil.of(SchemaType.OBJECT))
|
|
45
|
+
.setProperties(
|
|
46
|
+
new Map<string, Schema>([
|
|
47
|
+
[
|
|
48
|
+
NAMESPACE_STRING,
|
|
49
|
+
Schema.of(NAMESPACE_STRING, SchemaType.STRING).setDefaultValue(TEMPORARY),
|
|
50
|
+
],
|
|
51
|
+
['name', Schema.ofString('name')],
|
|
52
|
+
[VERSION_STRING, Schema.of(VERSION_STRING, SchemaType.INTEGER).setDefaultValue(1)],
|
|
53
|
+
['ref', Schema.ofString('ref')],
|
|
54
|
+
[
|
|
55
|
+
'type',
|
|
56
|
+
new Schema().setAnyOf([
|
|
57
|
+
Schema.TYPE_SCHEMA,
|
|
58
|
+
Schema.ofArray('type', Schema.TYPE_SCHEMA),
|
|
59
|
+
]),
|
|
60
|
+
],
|
|
61
|
+
['anyOf', Schema.ofArray('anyOf', Schema.ofRef(SCHEMA_ROOT_PATH))],
|
|
62
|
+
['allOf', Schema.ofArray('allOf', Schema.ofRef(SCHEMA_ROOT_PATH))],
|
|
63
|
+
['oneOf', Schema.ofArray('oneOf', Schema.ofRef(SCHEMA_ROOT_PATH))],
|
|
64
|
+
|
|
65
|
+
['not', Schema.ofRef(SCHEMA_ROOT_PATH)],
|
|
66
|
+
['title', Schema.ofString('title')],
|
|
67
|
+
['description', Schema.ofString('description')],
|
|
68
|
+
['id', Schema.ofString('id')],
|
|
69
|
+
['examples', Schema.ofAny('examples')],
|
|
70
|
+
['defaultValue', Schema.ofAny('defaultValue')],
|
|
71
|
+
['comment', Schema.ofString('comment')],
|
|
72
|
+
[ENUMS, Schema.ofArray(ENUMS, Schema.ofString(ENUMS))],
|
|
73
|
+
['constant', Schema.ofAny('constant')],
|
|
74
|
+
|
|
75
|
+
['pattern', Schema.ofString('pattern')],
|
|
76
|
+
[
|
|
77
|
+
'format',
|
|
78
|
+
Schema.of('format', SchemaType.STRING).setEnums([
|
|
79
|
+
'DATETIME',
|
|
80
|
+
'TIME',
|
|
81
|
+
'DATE',
|
|
82
|
+
'EMAIL',
|
|
83
|
+
'REGEX',
|
|
84
|
+
]),
|
|
85
|
+
],
|
|
86
|
+
['minLength', Schema.ofInteger('minLength')],
|
|
87
|
+
['maxLength', Schema.ofInteger('maxLength')],
|
|
88
|
+
|
|
89
|
+
['multipleOf', Schema.ofLong('multipleOf')],
|
|
90
|
+
['minimum', Schema.ofNumber('minimum')],
|
|
91
|
+
['maximum', Schema.ofNumber('maximum')],
|
|
92
|
+
['exclusiveMinimum', Schema.ofNumber('exclusiveMinimum')],
|
|
93
|
+
['exclusiveMaximum', Schema.ofNumber('exclusiveMaximum')],
|
|
94
|
+
|
|
95
|
+
[
|
|
96
|
+
'properties',
|
|
97
|
+
Schema.of('properties', SchemaType.OBJECT).setAdditionalProperties(
|
|
98
|
+
new AdditionalPropertiesType().setSchemaValue(
|
|
99
|
+
Schema.ofRef(SCHEMA_ROOT_PATH),
|
|
100
|
+
),
|
|
101
|
+
),
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
'additionalProperties',
|
|
105
|
+
new Schema()
|
|
106
|
+
.setName(ADDITIONAL_PROPERTY)
|
|
107
|
+
.setNamespace(Namespaces.SYSTEM)
|
|
108
|
+
.setAnyOf([
|
|
109
|
+
Schema.ofBoolean(ADDITIONAL_PROPERTY),
|
|
110
|
+
Schema.ofObject(ADDITIONAL_PROPERTY).setRef(SCHEMA_ROOT_PATH),
|
|
111
|
+
])
|
|
112
|
+
.setDefaultValue(true),
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
REQUIRED_STRING,
|
|
116
|
+
Schema.ofArray(
|
|
117
|
+
REQUIRED_STRING,
|
|
118
|
+
Schema.ofString(REQUIRED_STRING),
|
|
119
|
+
).setDefaultValue([]),
|
|
120
|
+
],
|
|
121
|
+
['propertyNames', Schema.ofRef(SCHEMA_ROOT_PATH)],
|
|
122
|
+
['minProperties', Schema.ofInteger('minProperties')],
|
|
123
|
+
['maxProperties', Schema.ofInteger('maxProperties')],
|
|
124
|
+
[
|
|
125
|
+
'patternProperties',
|
|
126
|
+
Schema.of('patternProperties', SchemaType.OBJECT).setAdditionalProperties(
|
|
127
|
+
new AdditionalPropertiesType().setSchemaValue(
|
|
128
|
+
Schema.ofRef(SCHEMA_ROOT_PATH),
|
|
129
|
+
),
|
|
130
|
+
),
|
|
131
|
+
],
|
|
132
|
+
|
|
133
|
+
[
|
|
134
|
+
ITEMS_STRING,
|
|
135
|
+
new Schema()
|
|
136
|
+
.setName(ITEMS_STRING)
|
|
137
|
+
.setAnyOf([
|
|
138
|
+
Schema.ofRef(SCHEMA_ROOT_PATH).setName('item'),
|
|
139
|
+
Schema.ofArray('tuple', Schema.ofRef(SCHEMA_ROOT_PATH)),
|
|
140
|
+
]),
|
|
141
|
+
],
|
|
142
|
+
|
|
143
|
+
['contains', Schema.ofRef(SCHEMA_ROOT_PATH)],
|
|
144
|
+
['minItems', Schema.ofInteger('minItems')],
|
|
145
|
+
['maxItems', Schema.ofInteger('maxItems')],
|
|
146
|
+
['uniqueItems', Schema.ofBoolean('uniqueItems')],
|
|
147
|
+
|
|
148
|
+
[
|
|
149
|
+
'$defs',
|
|
150
|
+
Schema.of('$defs', SchemaType.OBJECT).setAdditionalProperties(
|
|
151
|
+
new AdditionalPropertiesType().setSchemaValue(
|
|
152
|
+
Schema.ofRef(SCHEMA_ROOT_PATH),
|
|
153
|
+
),
|
|
154
|
+
),
|
|
155
|
+
],
|
|
156
|
+
|
|
157
|
+
['permission', Schema.ofString('permission')],
|
|
158
|
+
]),
|
|
159
|
+
)
|
|
160
|
+
.setRequired([]);
|
|
161
|
+
|
|
162
|
+
public static ofString(id: string): Schema {
|
|
163
|
+
return new Schema().setType(TypeUtil.of(SchemaType.STRING)).setName(id);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
public static ofInteger(id: string): Schema {
|
|
167
|
+
return new Schema().setType(TypeUtil.of(SchemaType.INTEGER)).setName(id);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
public static ofFloat(id: string): Schema {
|
|
171
|
+
return new Schema().setType(TypeUtil.of(SchemaType.FLOAT)).setName(id);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
public static ofLong(id: string): Schema {
|
|
175
|
+
return new Schema().setType(TypeUtil.of(SchemaType.LONG)).setName(id);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
public static ofDouble(id: string): Schema {
|
|
179
|
+
return new Schema().setType(TypeUtil.of(SchemaType.DOUBLE)).setName(id);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
public static ofAny(id: string): Schema {
|
|
183
|
+
return new Schema()
|
|
184
|
+
.setType(
|
|
185
|
+
TypeUtil.of(
|
|
186
|
+
SchemaType.INTEGER,
|
|
187
|
+
SchemaType.LONG,
|
|
188
|
+
SchemaType.FLOAT,
|
|
189
|
+
SchemaType.DOUBLE,
|
|
190
|
+
SchemaType.STRING,
|
|
191
|
+
SchemaType.BOOLEAN,
|
|
192
|
+
SchemaType.ARRAY,
|
|
193
|
+
SchemaType.NULL,
|
|
194
|
+
SchemaType.OBJECT,
|
|
195
|
+
),
|
|
196
|
+
)
|
|
197
|
+
.setName(id);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public static ofAnyNotNull(id: string): Schema {
|
|
201
|
+
return new Schema()
|
|
202
|
+
.setType(
|
|
203
|
+
TypeUtil.of(
|
|
204
|
+
SchemaType.INTEGER,
|
|
205
|
+
SchemaType.LONG,
|
|
206
|
+
SchemaType.FLOAT,
|
|
207
|
+
SchemaType.DOUBLE,
|
|
208
|
+
SchemaType.STRING,
|
|
209
|
+
SchemaType.BOOLEAN,
|
|
210
|
+
SchemaType.ARRAY,
|
|
211
|
+
SchemaType.OBJECT,
|
|
212
|
+
),
|
|
213
|
+
)
|
|
214
|
+
.setName(id);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
public static ofNumber(id: string): Schema {
|
|
218
|
+
return new Schema()
|
|
219
|
+
.setType(
|
|
220
|
+
TypeUtil.of(
|
|
221
|
+
SchemaType.INTEGER,
|
|
222
|
+
SchemaType.LONG,
|
|
223
|
+
SchemaType.FLOAT,
|
|
224
|
+
SchemaType.DOUBLE,
|
|
225
|
+
),
|
|
226
|
+
)
|
|
227
|
+
.setName(id);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
public static ofBoolean(id: string): Schema {
|
|
231
|
+
return new Schema().setType(TypeUtil.of(SchemaType.BOOLEAN)).setName(id);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public static of(id: string, ...types: SchemaType[]): Schema {
|
|
235
|
+
return new Schema().setType(TypeUtil.of(...types)).setName(id);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
public static ofObject(id: string): Schema {
|
|
239
|
+
return new Schema().setType(TypeUtil.of(SchemaType.OBJECT)).setName(id);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
public static ofRef(ref: string): Schema {
|
|
243
|
+
return new Schema().setRef(ref);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
public static ofArray(id: string, ...itemSchemas: Schema[]): Schema {
|
|
247
|
+
return new Schema()
|
|
248
|
+
.setType(TypeUtil.of(SchemaType.ARRAY))
|
|
249
|
+
.setName(id)
|
|
250
|
+
.setItems(ArraySchemaType.of(...itemSchemas));
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
public static fromListOfSchemas(list: any): Schema[] {
|
|
254
|
+
if (isNullValue(list) && !Array.isArray(list)) return [];
|
|
255
|
+
let x: Schema[] = [];
|
|
256
|
+
for (let e of Array.from(list)) {
|
|
257
|
+
let v = Schema.from(e);
|
|
258
|
+
if (!v) continue;
|
|
259
|
+
x.push(v);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return x;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
public static fromMapOfSchemas(map: any): Map<string, Schema> | undefined {
|
|
266
|
+
if (isNullValue(map)) return undefined;
|
|
267
|
+
const retMap = new Map<string, Schema>();
|
|
268
|
+
|
|
269
|
+
Object.entries(map).forEach(([k, v]) => {
|
|
270
|
+
let value = Schema.from(v);
|
|
271
|
+
if (!value) return;
|
|
272
|
+
retMap.set(k, value);
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
return retMap;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
public static from(obj: any, isStringSchema: boolean = false): Schema | undefined {
|
|
279
|
+
if (isNullValue(obj)) return undefined;
|
|
280
|
+
|
|
281
|
+
let schema: Schema = new Schema();
|
|
282
|
+
schema.namespace = obj.namespace;
|
|
283
|
+
schema.name = obj.name;
|
|
284
|
+
|
|
285
|
+
schema.version = obj.version;
|
|
286
|
+
|
|
287
|
+
schema.ref = obj.ref;
|
|
288
|
+
|
|
289
|
+
if (!isStringSchema) schema.type = TypeUtil.from(schema.type);
|
|
290
|
+
else schema.type = new SingleType(SchemaType.STRING);
|
|
291
|
+
|
|
292
|
+
schema.anyOf = Schema.fromListOfSchemas(obj.anyOf);
|
|
293
|
+
schema.allOf = Schema.fromListOfSchemas(obj.allOf);
|
|
294
|
+
schema.oneOf = Schema.fromListOfSchemas(obj.oneOf);
|
|
295
|
+
schema.not = Schema.from(obj.not);
|
|
296
|
+
|
|
297
|
+
schema.description = obj.description;
|
|
298
|
+
schema.examples = obj.examples ? [...obj.examples] : undefined;
|
|
299
|
+
schema.defaultValue = obj.defaultValue;
|
|
300
|
+
schema.comment = obj.comment;
|
|
301
|
+
schema.enums = obj.enums ? [...obj.enums] : undefined;
|
|
302
|
+
schema.constant = obj.constant;
|
|
303
|
+
|
|
304
|
+
// String
|
|
305
|
+
schema.pattern = obj.pattern;
|
|
306
|
+
schema.format = obj.format;
|
|
307
|
+
schema.minLength = obj.minLength;
|
|
308
|
+
schema.maxLength = obj.maxLength;
|
|
309
|
+
|
|
310
|
+
// Number
|
|
311
|
+
schema.multipleOf = obj.multipleOf;
|
|
312
|
+
schema.minimum = obj.minimum;
|
|
313
|
+
schema.maximum = obj.maximum;
|
|
314
|
+
schema.exclusiveMinimum = obj.exclusiveMinimum;
|
|
315
|
+
schema.exclusiveMaximum = obj.exclusiveMaximum;
|
|
316
|
+
|
|
317
|
+
// Object
|
|
318
|
+
schema.properties = Schema.fromMapOfSchemas(obj.properties);
|
|
319
|
+
schema.additionalProperties = AdditionalPropertiesType.from(obj.additionalProperties);
|
|
320
|
+
schema.required = obj.required;
|
|
321
|
+
schema.propertyNames = Schema.from(obj.propertyNames, true);
|
|
322
|
+
schema.minProperties = obj.minProperties;
|
|
323
|
+
schema.maxProperties = obj.maxProperties;
|
|
324
|
+
schema.patternProperties = Schema.fromMapOfSchemas(obj.patternProperties);
|
|
325
|
+
|
|
326
|
+
// Array
|
|
327
|
+
schema.items = ArraySchemaType.from(obj.items);
|
|
328
|
+
schema.contains = Schema.from(obj.contains);
|
|
329
|
+
schema.minItems = obj.minItems;
|
|
330
|
+
schema.maxItems = obj.maxItems;
|
|
331
|
+
schema.uniqueItems = obj.uniqueItems;
|
|
332
|
+
|
|
333
|
+
schema.$defs = Schema.fromMapOfSchemas(obj.$defs);
|
|
334
|
+
schema.permission = obj.permission;
|
|
335
|
+
|
|
336
|
+
return schema;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
private namespace: string = TEMPORARY;
|
|
340
|
+
private name?: string;
|
|
341
|
+
|
|
342
|
+
private version: number = 1;
|
|
343
|
+
|
|
344
|
+
private ref?: string;
|
|
345
|
+
|
|
346
|
+
private type?: Type;
|
|
347
|
+
private anyOf?: Schema[];
|
|
348
|
+
private allOf?: Schema[];
|
|
349
|
+
private oneOf?: Schema[];
|
|
350
|
+
private not?: Schema;
|
|
351
|
+
|
|
352
|
+
private description?: string;
|
|
353
|
+
private examples?: any[];
|
|
354
|
+
private defaultValue?: any;
|
|
355
|
+
private comment?: string;
|
|
356
|
+
private enums?: any[];
|
|
357
|
+
private constant?: any;
|
|
358
|
+
|
|
359
|
+
// String
|
|
360
|
+
private pattern?: string;
|
|
361
|
+
private format?: StringFormat;
|
|
362
|
+
private minLength?: number;
|
|
363
|
+
private maxLength?: number;
|
|
364
|
+
|
|
365
|
+
// Number
|
|
366
|
+
private multipleOf?: number;
|
|
367
|
+
private minimum?: number;
|
|
368
|
+
private maximum?: number;
|
|
369
|
+
private exclusiveMinimum?: number;
|
|
370
|
+
private exclusiveMaximum?: number;
|
|
371
|
+
|
|
372
|
+
// Object
|
|
373
|
+
private properties?: Map<string, Schema>;
|
|
374
|
+
private additionalProperties?: AdditionalPropertiesType;
|
|
375
|
+
private required?: string[];
|
|
376
|
+
private propertyNames?: Schema;
|
|
377
|
+
private minProperties?: number;
|
|
378
|
+
private maxProperties?: number;
|
|
379
|
+
private patternProperties?: Map<string, Schema>;
|
|
380
|
+
|
|
381
|
+
// Array
|
|
382
|
+
private items?: ArraySchemaType;
|
|
383
|
+
private contains?: Schema;
|
|
384
|
+
private minItems?: number;
|
|
385
|
+
private maxItems?: number;
|
|
386
|
+
private uniqueItems?: boolean;
|
|
387
|
+
|
|
388
|
+
private $defs?: Map<string, Schema>;
|
|
389
|
+
private permission?: string;
|
|
390
|
+
|
|
391
|
+
public getTitle(): string | undefined {
|
|
392
|
+
return this.getFullName();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
private getFullName(): string | undefined {
|
|
396
|
+
if (!this.namespace || this.namespace == TEMPORARY) return this.name;
|
|
397
|
+
|
|
398
|
+
return this.namespace + '.' + this.name;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
public get$defs(): Map<string, Schema> | undefined {
|
|
402
|
+
return this.$defs;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
public set$defs($defs: Map<string, Schema>): Schema {
|
|
406
|
+
this.$defs = $defs;
|
|
407
|
+
return this;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
public getNamespace(): string {
|
|
411
|
+
return this.namespace;
|
|
412
|
+
}
|
|
413
|
+
public setNamespace(namespace: string): Schema {
|
|
414
|
+
this.namespace = namespace;
|
|
415
|
+
return this;
|
|
416
|
+
}
|
|
417
|
+
public getName(): string | undefined {
|
|
418
|
+
return this.name;
|
|
419
|
+
}
|
|
420
|
+
public setName(name: string): Schema {
|
|
421
|
+
this.name = name;
|
|
422
|
+
return this;
|
|
423
|
+
}
|
|
424
|
+
public getVersion(): number {
|
|
425
|
+
return this.version;
|
|
426
|
+
}
|
|
427
|
+
public setVersion(version: number): Schema {
|
|
428
|
+
this.version = version;
|
|
429
|
+
return this;
|
|
430
|
+
}
|
|
431
|
+
public getRef(): string | undefined {
|
|
432
|
+
return this.ref;
|
|
433
|
+
}
|
|
434
|
+
public setRef(ref: string): Schema {
|
|
435
|
+
this.ref = ref;
|
|
436
|
+
return this;
|
|
437
|
+
}
|
|
438
|
+
public getType(): Type | undefined {
|
|
439
|
+
return this.type;
|
|
440
|
+
}
|
|
441
|
+
public setType(type: Type): Schema {
|
|
442
|
+
this.type = type;
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
public getAnyOf(): Schema[] | undefined {
|
|
446
|
+
return this.anyOf;
|
|
447
|
+
}
|
|
448
|
+
public setAnyOf(anyOf: Schema[]): Schema {
|
|
449
|
+
this.anyOf = anyOf;
|
|
450
|
+
return this;
|
|
451
|
+
}
|
|
452
|
+
public getAllOf(): Schema[] | undefined {
|
|
453
|
+
return this.allOf;
|
|
454
|
+
}
|
|
455
|
+
public setAllOf(allOf: Schema[]): Schema {
|
|
456
|
+
this.allOf = allOf;
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
public getOneOf(): Schema[] | undefined {
|
|
460
|
+
return this.oneOf;
|
|
461
|
+
}
|
|
462
|
+
public setOneOf(oneOf: Schema[]): Schema {
|
|
463
|
+
this.oneOf = oneOf;
|
|
464
|
+
return this;
|
|
465
|
+
}
|
|
466
|
+
public getNot(): Schema | undefined {
|
|
467
|
+
return this.not;
|
|
468
|
+
}
|
|
469
|
+
public setNot(not: Schema): Schema {
|
|
470
|
+
this.not = not;
|
|
471
|
+
return this;
|
|
472
|
+
}
|
|
473
|
+
public getDescription(): string | undefined {
|
|
474
|
+
return this.description;
|
|
475
|
+
}
|
|
476
|
+
public setDescription(description: string): Schema {
|
|
477
|
+
this.description = description;
|
|
478
|
+
return this;
|
|
479
|
+
}
|
|
480
|
+
public getExamples(): any[] | undefined {
|
|
481
|
+
return this.examples;
|
|
482
|
+
}
|
|
483
|
+
public setExamples(examples: any[]): Schema {
|
|
484
|
+
this.examples = examples;
|
|
485
|
+
return this;
|
|
486
|
+
}
|
|
487
|
+
public getDefaultValue(): any {
|
|
488
|
+
return this.defaultValue;
|
|
489
|
+
}
|
|
490
|
+
public setDefaultValue(defaultValue: any): Schema {
|
|
491
|
+
this.defaultValue = defaultValue;
|
|
492
|
+
return this;
|
|
493
|
+
}
|
|
494
|
+
public getComment(): string | undefined {
|
|
495
|
+
return this.comment;
|
|
496
|
+
}
|
|
497
|
+
public setComment(comment: string): Schema {
|
|
498
|
+
this.comment = comment;
|
|
499
|
+
return this;
|
|
500
|
+
}
|
|
501
|
+
public getEnums(): any[] | undefined {
|
|
502
|
+
return this.enums;
|
|
503
|
+
}
|
|
504
|
+
public setEnums(enums: any[]): Schema {
|
|
505
|
+
this.enums = enums;
|
|
506
|
+
return this;
|
|
507
|
+
}
|
|
508
|
+
public getConstant(): any {
|
|
509
|
+
return this.constant;
|
|
510
|
+
}
|
|
511
|
+
public setConstant(constant: any): Schema {
|
|
512
|
+
this.constant = constant;
|
|
513
|
+
return this;
|
|
514
|
+
}
|
|
515
|
+
public getPattern(): string | undefined {
|
|
516
|
+
return this.pattern;
|
|
517
|
+
}
|
|
518
|
+
public setPattern(pattern: string): Schema {
|
|
519
|
+
this.pattern = pattern;
|
|
520
|
+
return this;
|
|
521
|
+
}
|
|
522
|
+
public getFormat(): StringFormat | undefined {
|
|
523
|
+
return this.format;
|
|
524
|
+
}
|
|
525
|
+
public setFormat(format: StringFormat): Schema {
|
|
526
|
+
this.format = format;
|
|
527
|
+
return this;
|
|
528
|
+
}
|
|
529
|
+
public getMinLength(): number | undefined {
|
|
530
|
+
return this.minLength;
|
|
531
|
+
}
|
|
532
|
+
public setMinLength(minLength: number): Schema {
|
|
533
|
+
this.minLength = minLength;
|
|
534
|
+
return this;
|
|
535
|
+
}
|
|
536
|
+
public getMaxLength(): number | undefined {
|
|
537
|
+
return this.maxLength;
|
|
538
|
+
}
|
|
539
|
+
public setMaxLength(maxLength: number): Schema {
|
|
540
|
+
this.maxLength = maxLength;
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
543
|
+
public getMultipleOf(): number | undefined {
|
|
544
|
+
return this.multipleOf;
|
|
545
|
+
}
|
|
546
|
+
public setMultipleOf(multipleOf: number): Schema {
|
|
547
|
+
this.multipleOf = multipleOf;
|
|
548
|
+
return this;
|
|
549
|
+
}
|
|
550
|
+
public getMinimum(): number | undefined {
|
|
551
|
+
return this.minimum;
|
|
552
|
+
}
|
|
553
|
+
public setMinimum(minimum: number): Schema {
|
|
554
|
+
this.minimum = minimum;
|
|
555
|
+
return this;
|
|
556
|
+
}
|
|
557
|
+
public getMaximum(): number | undefined {
|
|
558
|
+
return this.maximum;
|
|
559
|
+
}
|
|
560
|
+
public setMaximum(maximum: number): Schema {
|
|
561
|
+
this.maximum = maximum;
|
|
562
|
+
return this;
|
|
563
|
+
}
|
|
564
|
+
public getExclusiveMinimum(): number | undefined {
|
|
565
|
+
return this.exclusiveMinimum;
|
|
566
|
+
}
|
|
567
|
+
public setExclusiveMinimum(exclusiveMinimum: number): Schema {
|
|
568
|
+
this.exclusiveMinimum = exclusiveMinimum;
|
|
569
|
+
return this;
|
|
570
|
+
}
|
|
571
|
+
public getExclusiveMaximum(): number | undefined {
|
|
572
|
+
return this.exclusiveMaximum;
|
|
573
|
+
}
|
|
574
|
+
public setExclusiveMaximum(exclusiveMaximum: number): Schema {
|
|
575
|
+
this.exclusiveMaximum = exclusiveMaximum;
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
578
|
+
public getProperties(): Map<string, Schema> | undefined {
|
|
579
|
+
return this.properties;
|
|
580
|
+
}
|
|
581
|
+
public setProperties(properties: Map<string, Schema>): Schema {
|
|
582
|
+
this.properties = properties;
|
|
583
|
+
return this;
|
|
584
|
+
}
|
|
585
|
+
public getAdditionalProperties(): AdditionalPropertiesType | undefined {
|
|
586
|
+
return this.additionalProperties;
|
|
587
|
+
}
|
|
588
|
+
public setAdditionalProperties(additionalProperties: AdditionalPropertiesType): Schema {
|
|
589
|
+
this.additionalProperties = additionalProperties;
|
|
590
|
+
return this;
|
|
591
|
+
}
|
|
592
|
+
public getRequired(): string[] | undefined {
|
|
593
|
+
return this.required;
|
|
594
|
+
}
|
|
595
|
+
public setRequired(required: string[]): Schema {
|
|
596
|
+
this.required = required;
|
|
597
|
+
return this;
|
|
598
|
+
}
|
|
599
|
+
public getPropertyNames(): Schema | undefined {
|
|
600
|
+
return this.propertyNames;
|
|
601
|
+
}
|
|
602
|
+
public setPropertyNames(propertyNames: Schema): Schema {
|
|
603
|
+
this.propertyNames = propertyNames;
|
|
604
|
+
this.propertyNames.type = new SingleType(SchemaType.STRING);
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
607
|
+
public getMinProperties(): number | undefined {
|
|
608
|
+
return this.minProperties;
|
|
609
|
+
}
|
|
610
|
+
public setMinProperties(minProperties: number): Schema {
|
|
611
|
+
this.minProperties = minProperties;
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
614
|
+
public getMaxProperties(): number | undefined {
|
|
615
|
+
return this.maxProperties;
|
|
616
|
+
}
|
|
617
|
+
public setMaxProperties(maxProperties: number): Schema {
|
|
618
|
+
this.maxProperties = maxProperties;
|
|
619
|
+
return this;
|
|
620
|
+
}
|
|
621
|
+
public getPatternProperties(): Map<string, Schema> | undefined {
|
|
622
|
+
return this.patternProperties;
|
|
623
|
+
}
|
|
624
|
+
public setPatternProperties(patternProperties: Map<string, Schema>): Schema {
|
|
625
|
+
this.patternProperties = patternProperties;
|
|
626
|
+
return this;
|
|
627
|
+
}
|
|
628
|
+
public getItems(): ArraySchemaType | undefined {
|
|
629
|
+
return this.items;
|
|
630
|
+
}
|
|
631
|
+
public setItems(items: ArraySchemaType): Schema {
|
|
632
|
+
this.items = items;
|
|
633
|
+
return this;
|
|
634
|
+
}
|
|
635
|
+
public getContains(): Schema | undefined {
|
|
636
|
+
return this.contains;
|
|
637
|
+
}
|
|
638
|
+
public setContains(contains: Schema): Schema {
|
|
639
|
+
this.contains = contains;
|
|
640
|
+
return this;
|
|
641
|
+
}
|
|
642
|
+
public getMinItems(): number | undefined {
|
|
643
|
+
return this.minItems;
|
|
644
|
+
}
|
|
645
|
+
public setMinItems(minItems: number): Schema {
|
|
646
|
+
this.minItems = minItems;
|
|
647
|
+
return this;
|
|
648
|
+
}
|
|
649
|
+
public getMaxItems(): number | undefined {
|
|
650
|
+
return this.maxItems;
|
|
651
|
+
}
|
|
652
|
+
public setMaxItems(maxItems: number): Schema {
|
|
653
|
+
this.maxItems = maxItems;
|
|
654
|
+
return this;
|
|
655
|
+
}
|
|
656
|
+
public getUniqueItems(): boolean | undefined {
|
|
657
|
+
return this.uniqueItems;
|
|
658
|
+
}
|
|
659
|
+
public setUniqueItems(uniqueItems: boolean): Schema {
|
|
660
|
+
this.uniqueItems = uniqueItems;
|
|
661
|
+
return this;
|
|
662
|
+
}
|
|
663
|
+
public getPermission(): string | undefined {
|
|
664
|
+
return this.permission;
|
|
665
|
+
}
|
|
666
|
+
public setPermission(permission: string): Schema {
|
|
667
|
+
this.permission = permission;
|
|
668
|
+
return this;
|
|
669
|
+
}
|
|
670
|
+
}
|