@hideyukimori/nene2-client 0.1.4 → 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/README.md +1 -1
- package/dist/generated/guards.d.ts +50 -0
- package/dist/generated/guards.d.ts.map +1 -0
- package/dist/generated/guards.js +810 -0
- package/dist/generated/guards.js.map +1 -0
- package/dist/types/examples/notes.d.ts +0 -3
- package/dist/types/examples/notes.d.ts.map +1 -1
- package/dist/types/examples/notes.js +7 -24
- package/dist/types/examples/notes.js.map +1 -1
- package/dist/types/examples/protected.d.ts +0 -3
- package/dist/types/examples/protected.d.ts.map +1 -1
- package/dist/types/examples/protected.js +5 -8
- package/dist/types/examples/protected.js.map +1 -1
- package/dist/types/examples/tags.d.ts +0 -3
- package/dist/types/examples/tags.d.ts.map +1 -1
- package/dist/types/examples/tags.js +7 -21
- package/dist/types/examples/tags.js.map +1 -1
- package/dist/types/system.d.ts +0 -3
- package/dist/types/system.d.ts.map +1 -1
- package/dist/types/system.js +8 -38
- package/dist/types/system.js.map +1 -1
- package/package.json +10 -3
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @generated from contracts/openapi.yaml — do not edit.
|
|
3
|
+
* Regenerate: npm run codegen:guards
|
|
4
|
+
* @see docs/adr/0007-openapi-guard-codegen-ajv-standalone.md
|
|
5
|
+
*/
|
|
6
|
+
/* eslint-disable */
|
|
7
|
+
// @ts-nocheck
|
|
8
|
+
function ucs2length(str) {
|
|
9
|
+
return [...str].length;
|
|
10
|
+
}
|
|
11
|
+
const schema_HealthResponse = { "type": "object", "required": ["status", "service"], "properties": { "status": { "type": "string", "enum": ["ok", "degraded"], "example": "ok" }, "service": { "type": "string", "example": "NENE2" }, "checks": { "type": "object", "description": "Present only when health checks are configured. Each key is a check name; each value is \"ok\" or \"error\".\n", "additionalProperties": { "type": "string", "enum": ["ok", "error"] }, "example": { "database": "ok" } } } };
|
|
12
|
+
export function validateHealthResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
13
|
+
let vErrors = null;
|
|
14
|
+
let errors = 0;
|
|
15
|
+
if (errors === 0) {
|
|
16
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
17
|
+
let missing0;
|
|
18
|
+
if (((data.status === undefined) && (missing0 = "status")) || ((data.service === undefined) && (missing0 = "service"))) {
|
|
19
|
+
validateHealthResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
if (data.status !== undefined) {
|
|
24
|
+
let data0 = data.status;
|
|
25
|
+
const _errs1 = errors;
|
|
26
|
+
if (typeof data0 !== "string") {
|
|
27
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
if (!((data0 === "ok") || (data0 === "degraded"))) {
|
|
31
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/enum", keyword: "enum", params: { allowedValues: schema_HealthResponse.properties.status.enum }, message: "must be equal to one of the allowed values" }];
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
var valid0 = _errs1 === errors;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
var valid0 = true;
|
|
38
|
+
}
|
|
39
|
+
if (valid0) {
|
|
40
|
+
if (data.service !== undefined) {
|
|
41
|
+
const _errs3 = errors;
|
|
42
|
+
if (typeof data.service !== "string") {
|
|
43
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/service", schemaPath: "#/properties/service/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
var valid0 = _errs3 === errors;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
var valid0 = true;
|
|
50
|
+
}
|
|
51
|
+
if (valid0) {
|
|
52
|
+
if (data.checks !== undefined) {
|
|
53
|
+
let data2 = data.checks;
|
|
54
|
+
const _errs5 = errors;
|
|
55
|
+
if (errors === _errs5) {
|
|
56
|
+
if (data2 && typeof data2 == "object" && !Array.isArray(data2)) {
|
|
57
|
+
for (const key0 in data2) {
|
|
58
|
+
let data3 = data2[key0];
|
|
59
|
+
const _errs8 = errors;
|
|
60
|
+
if (typeof data3 !== "string") {
|
|
61
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/checks/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/checks/additionalProperties/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (!((data3 === "ok") || (data3 === "error"))) {
|
|
65
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/checks/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"), schemaPath: "#/properties/checks/additionalProperties/enum", keyword: "enum", params: { allowedValues: schema_HealthResponse.properties.checks.additionalProperties.enum }, message: "must be equal to one of the allowed values" }];
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
var valid1 = _errs8 === errors;
|
|
69
|
+
if (!valid1) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
validateHealthResponse.errors = [{ instancePath: instancePath + "/checks", schemaPath: "#/properties/checks/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
var valid0 = _errs5 === errors;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
var valid0 = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
validateHealthResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
validateHealthResponse.errors = vErrors;
|
|
94
|
+
return errors === 0;
|
|
95
|
+
}
|
|
96
|
+
const schema_ExamplePingResponse = { "type": "object", "required": ["message", "status"], "properties": { "message": { "type": "string", "enum": ["pong"], "example": "pong" }, "status": { "type": "string", "enum": ["ok"], "example": "ok" } } };
|
|
97
|
+
export function validateExamplePingResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
98
|
+
let vErrors = null;
|
|
99
|
+
let errors = 0;
|
|
100
|
+
if (errors === 0) {
|
|
101
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
102
|
+
let missing0;
|
|
103
|
+
if (((data.message === undefined) && (missing0 = "message")) || ((data.status === undefined) && (missing0 = "status"))) {
|
|
104
|
+
validateExamplePingResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
if (data.message !== undefined) {
|
|
109
|
+
let data0 = data.message;
|
|
110
|
+
const _errs1 = errors;
|
|
111
|
+
if (typeof data0 !== "string") {
|
|
112
|
+
validateExamplePingResponse.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
if (!(data0 === "pong")) {
|
|
116
|
+
validateExamplePingResponse.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/properties/message/enum", keyword: "enum", params: { allowedValues: schema_ExamplePingResponse.properties.message.enum }, message: "must be equal to one of the allowed values" }];
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
var valid0 = _errs1 === errors;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
var valid0 = true;
|
|
123
|
+
}
|
|
124
|
+
if (valid0) {
|
|
125
|
+
if (data.status !== undefined) {
|
|
126
|
+
let data1 = data.status;
|
|
127
|
+
const _errs3 = errors;
|
|
128
|
+
if (typeof data1 !== "string") {
|
|
129
|
+
validateExamplePingResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (!(data1 === "ok")) {
|
|
133
|
+
validateExamplePingResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/enum", keyword: "enum", params: { allowedValues: schema_ExamplePingResponse.properties.status.enum }, message: "must be equal to one of the allowed values" }];
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
var valid0 = _errs3 === errors;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
var valid0 = true;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
validateExamplePingResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
validateExamplePingResponse.errors = vErrors;
|
|
150
|
+
return errors === 0;
|
|
151
|
+
}
|
|
152
|
+
const schema_FrameworkSmokeResponse = { "type": "object", "required": ["name", "description", "status"], "properties": { "name": { "type": "string", "example": "NENE2" }, "description": { "type": "string", "example": "JSON APIs first, minimal server HTML, frontend ready, AI-readable." }, "status": { "type": "string", "enum": ["ok"], "example": "ok" } } };
|
|
153
|
+
export function validateFrameworkSmokeResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
154
|
+
let vErrors = null;
|
|
155
|
+
let errors = 0;
|
|
156
|
+
if (errors === 0) {
|
|
157
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
158
|
+
let missing0;
|
|
159
|
+
if ((((data.name === undefined) && (missing0 = "name")) || ((data.description === undefined) && (missing0 = "description"))) || ((data.status === undefined) && (missing0 = "status"))) {
|
|
160
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
if (data.name !== undefined) {
|
|
165
|
+
const _errs1 = errors;
|
|
166
|
+
if (typeof data.name !== "string") {
|
|
167
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
var valid0 = _errs1 === errors;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
var valid0 = true;
|
|
174
|
+
}
|
|
175
|
+
if (valid0) {
|
|
176
|
+
if (data.description !== undefined) {
|
|
177
|
+
const _errs3 = errors;
|
|
178
|
+
if (typeof data.description !== "string") {
|
|
179
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath: instancePath + "/description", schemaPath: "#/properties/description/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
var valid0 = _errs3 === errors;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
var valid0 = true;
|
|
186
|
+
}
|
|
187
|
+
if (valid0) {
|
|
188
|
+
if (data.status !== undefined) {
|
|
189
|
+
let data2 = data.status;
|
|
190
|
+
const _errs5 = errors;
|
|
191
|
+
if (typeof data2 !== "string") {
|
|
192
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
if (!(data2 === "ok")) {
|
|
196
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/enum", keyword: "enum", params: { allowedValues: schema_FrameworkSmokeResponse.properties.status.enum }, message: "must be equal to one of the allowed values" }];
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
var valid0 = _errs5 === errors;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
var valid0 = true;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
validateFrameworkSmokeResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
validateFrameworkSmokeResponse.errors = vErrors;
|
|
214
|
+
return errors === 0;
|
|
215
|
+
}
|
|
216
|
+
const schema_MachineHealthResponse = { "type": "object", "required": ["status", "service", "credential_type"], "properties": { "status": { "type": "string", "enum": ["ok"], "example": "ok" }, "service": { "type": "string", "example": "NENE2" }, "credential_type": { "type": "string", "enum": ["api_key"], "example": "api_key" } } };
|
|
217
|
+
export function validateMachineHealthResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
218
|
+
let vErrors = null;
|
|
219
|
+
let errors = 0;
|
|
220
|
+
if (errors === 0) {
|
|
221
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
222
|
+
let missing0;
|
|
223
|
+
if ((((data.status === undefined) && (missing0 = "status")) || ((data.service === undefined) && (missing0 = "service"))) || ((data.credential_type === undefined) && (missing0 = "credential_type"))) {
|
|
224
|
+
validateMachineHealthResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
if (data.status !== undefined) {
|
|
229
|
+
let data0 = data.status;
|
|
230
|
+
const _errs1 = errors;
|
|
231
|
+
if (typeof data0 !== "string") {
|
|
232
|
+
validateMachineHealthResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (!(data0 === "ok")) {
|
|
236
|
+
validateMachineHealthResponse.errors = [{ instancePath: instancePath + "/status", schemaPath: "#/properties/status/enum", keyword: "enum", params: { allowedValues: schema_MachineHealthResponse.properties.status.enum }, message: "must be equal to one of the allowed values" }];
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
var valid0 = _errs1 === errors;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
var valid0 = true;
|
|
243
|
+
}
|
|
244
|
+
if (valid0) {
|
|
245
|
+
if (data.service !== undefined) {
|
|
246
|
+
const _errs3 = errors;
|
|
247
|
+
if (typeof data.service !== "string") {
|
|
248
|
+
validateMachineHealthResponse.errors = [{ instancePath: instancePath + "/service", schemaPath: "#/properties/service/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
249
|
+
return false;
|
|
250
|
+
}
|
|
251
|
+
var valid0 = _errs3 === errors;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
var valid0 = true;
|
|
255
|
+
}
|
|
256
|
+
if (valid0) {
|
|
257
|
+
if (data.credential_type !== undefined) {
|
|
258
|
+
let data2 = data.credential_type;
|
|
259
|
+
const _errs5 = errors;
|
|
260
|
+
if (typeof data2 !== "string") {
|
|
261
|
+
validateMachineHealthResponse.errors = [{ instancePath: instancePath + "/credential_type", schemaPath: "#/properties/credential_type/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
262
|
+
return false;
|
|
263
|
+
}
|
|
264
|
+
if (!(data2 === "api_key")) {
|
|
265
|
+
validateMachineHealthResponse.errors = [{ instancePath: instancePath + "/credential_type", schemaPath: "#/properties/credential_type/enum", keyword: "enum", params: { allowedValues: schema_MachineHealthResponse.properties.credential_type.enum }, message: "must be equal to one of the allowed values" }];
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
var valid0 = _errs5 === errors;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
var valid0 = true;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
validateMachineHealthResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
validateMachineHealthResponse.errors = vErrors;
|
|
283
|
+
return errors === 0;
|
|
284
|
+
}
|
|
285
|
+
const schema_ExampleNoteResponse = { "type": "object", "required": ["id", "title", "body"], "properties": { "id": { "type": "integer", "example": 1 }, "title": { "type": "string", "example": "Example Note" }, "body": { "type": "string", "example": "This is the body of an example note." } } };
|
|
286
|
+
export function validateExampleNoteResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
287
|
+
let vErrors = null;
|
|
288
|
+
let errors = 0;
|
|
289
|
+
if (errors === 0) {
|
|
290
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
291
|
+
let missing0;
|
|
292
|
+
if ((((data.id === undefined) && (missing0 = "id")) || ((data.title === undefined) && (missing0 = "title"))) || ((data.body === undefined) && (missing0 = "body"))) {
|
|
293
|
+
validateExampleNoteResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
294
|
+
return false;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
if (data.id !== undefined) {
|
|
298
|
+
let data0 = data.id;
|
|
299
|
+
const _errs1 = errors;
|
|
300
|
+
if (!((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0)))) {
|
|
301
|
+
validateExampleNoteResponse.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
302
|
+
return false;
|
|
303
|
+
}
|
|
304
|
+
var valid0 = _errs1 === errors;
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
var valid0 = true;
|
|
308
|
+
}
|
|
309
|
+
if (valid0) {
|
|
310
|
+
if (data.title !== undefined) {
|
|
311
|
+
const _errs3 = errors;
|
|
312
|
+
if (typeof data.title !== "string") {
|
|
313
|
+
validateExampleNoteResponse.errors = [{ instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
314
|
+
return false;
|
|
315
|
+
}
|
|
316
|
+
var valid0 = _errs3 === errors;
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
var valid0 = true;
|
|
320
|
+
}
|
|
321
|
+
if (valid0) {
|
|
322
|
+
if (data.body !== undefined) {
|
|
323
|
+
const _errs5 = errors;
|
|
324
|
+
if (typeof data.body !== "string") {
|
|
325
|
+
validateExampleNoteResponse.errors = [{ instancePath: instancePath + "/body", schemaPath: "#/properties/body/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
326
|
+
return false;
|
|
327
|
+
}
|
|
328
|
+
var valid0 = _errs5 === errors;
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
var valid0 = true;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
validateExampleNoteResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
339
|
+
return false;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
validateExampleNoteResponse.errors = vErrors;
|
|
343
|
+
return errors === 0;
|
|
344
|
+
}
|
|
345
|
+
const schema_ExampleNoteListResponse = { "type": "object", "required": ["items", "limit", "offset"], "properties": { "items": { "type": "array", "items": { "type": "object", "required": ["id", "title", "body"], "properties": { "id": { "type": "integer", "example": 1 }, "title": { "type": "string", "example": "Example Note" }, "body": { "type": "string", "example": "This is the body of an example note." } } } }, "limit": { "type": "integer", "example": 20 }, "offset": { "type": "integer", "example": 0 } } };
|
|
346
|
+
export function validateExampleNoteListResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
347
|
+
let vErrors = null;
|
|
348
|
+
let errors = 0;
|
|
349
|
+
if (errors === 0) {
|
|
350
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
351
|
+
let missing0;
|
|
352
|
+
if ((((data.items === undefined) && (missing0 = "items")) || ((data.limit === undefined) && (missing0 = "limit"))) || ((data.offset === undefined) && (missing0 = "offset"))) {
|
|
353
|
+
validateExampleNoteListResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
else {
|
|
357
|
+
if (data.items !== undefined) {
|
|
358
|
+
let data0 = data.items;
|
|
359
|
+
const _errs1 = errors;
|
|
360
|
+
if (errors === _errs1) {
|
|
361
|
+
if (Array.isArray(data0)) {
|
|
362
|
+
var valid1 = true;
|
|
363
|
+
const len0 = data0.length;
|
|
364
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
365
|
+
let data1 = data0[i0];
|
|
366
|
+
const _errs3 = errors;
|
|
367
|
+
if (errors === _errs3) {
|
|
368
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
369
|
+
let missing1;
|
|
370
|
+
if ((((data1.id === undefined) && (missing1 = "id")) || ((data1.title === undefined) && (missing1 = "title"))) || ((data1.body === undefined) && (missing1 = "body"))) {
|
|
371
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/properties/items/items/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
372
|
+
return false;
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
375
|
+
if (data1.id !== undefined) {
|
|
376
|
+
let data2 = data1.id;
|
|
377
|
+
const _errs5 = errors;
|
|
378
|
+
if (!((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2)))) {
|
|
379
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items/" + i0 + "/id", schemaPath: "#/properties/items/items/properties/id/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
382
|
+
var valid2 = _errs5 === errors;
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
var valid2 = true;
|
|
386
|
+
}
|
|
387
|
+
if (valid2) {
|
|
388
|
+
if (data1.title !== undefined) {
|
|
389
|
+
const _errs7 = errors;
|
|
390
|
+
if (typeof data1.title !== "string") {
|
|
391
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items/" + i0 + "/title", schemaPath: "#/properties/items/items/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
var valid2 = _errs7 === errors;
|
|
395
|
+
}
|
|
396
|
+
else {
|
|
397
|
+
var valid2 = true;
|
|
398
|
+
}
|
|
399
|
+
if (valid2) {
|
|
400
|
+
if (data1.body !== undefined) {
|
|
401
|
+
const _errs9 = errors;
|
|
402
|
+
if (typeof data1.body !== "string") {
|
|
403
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items/" + i0 + "/body", schemaPath: "#/properties/items/items/properties/body/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
var valid2 = _errs9 === errors;
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
var valid2 = true;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/properties/items/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
var valid1 = _errs3 === errors;
|
|
421
|
+
if (!valid1) {
|
|
422
|
+
break;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
else {
|
|
427
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/items", schemaPath: "#/properties/items/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
428
|
+
return false;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
var valid0 = _errs1 === errors;
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
var valid0 = true;
|
|
435
|
+
}
|
|
436
|
+
if (valid0) {
|
|
437
|
+
if (data.limit !== undefined) {
|
|
438
|
+
let data5 = data.limit;
|
|
439
|
+
const _errs11 = errors;
|
|
440
|
+
if (!((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5)))) {
|
|
441
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/limit", schemaPath: "#/properties/limit/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
var valid0 = _errs11 === errors;
|
|
445
|
+
}
|
|
446
|
+
else {
|
|
447
|
+
var valid0 = true;
|
|
448
|
+
}
|
|
449
|
+
if (valid0) {
|
|
450
|
+
if (data.offset !== undefined) {
|
|
451
|
+
let data6 = data.offset;
|
|
452
|
+
const _errs13 = errors;
|
|
453
|
+
if (!((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6)))) {
|
|
454
|
+
validateExampleNoteListResponse.errors = [{ instancePath: instancePath + "/offset", schemaPath: "#/properties/offset/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
455
|
+
return false;
|
|
456
|
+
}
|
|
457
|
+
var valid0 = _errs13 === errors;
|
|
458
|
+
}
|
|
459
|
+
else {
|
|
460
|
+
var valid0 = true;
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else {
|
|
467
|
+
validateExampleNoteListResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
468
|
+
return false;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
validateExampleNoteListResponse.errors = vErrors;
|
|
472
|
+
return errors === 0;
|
|
473
|
+
}
|
|
474
|
+
const schema_CreateNoteRequest = { "type": "object", "required": ["title", "body"], "properties": { "title": { "type": "string", "minLength": 1, "example": "Example Note" }, "body": { "type": "string", "minLength": 1, "example": "This is the body of an example note." } }, "additionalProperties": false };
|
|
475
|
+
export function validateCreateNoteRequest(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
476
|
+
let vErrors = null;
|
|
477
|
+
let errors = 0;
|
|
478
|
+
if (errors === 0) {
|
|
479
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
480
|
+
let missing0;
|
|
481
|
+
if (((data.title === undefined) && (missing0 = "title")) || ((data.body === undefined) && (missing0 = "body"))) {
|
|
482
|
+
validateCreateNoteRequest.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
const _errs1 = errors;
|
|
487
|
+
for (const key0 in data) {
|
|
488
|
+
if (!((key0 === "title") || (key0 === "body"))) {
|
|
489
|
+
validateCreateNoteRequest.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
490
|
+
return false;
|
|
491
|
+
break;
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
if (_errs1 === errors) {
|
|
495
|
+
if (data.title !== undefined) {
|
|
496
|
+
let data0 = data.title;
|
|
497
|
+
const _errs2 = errors;
|
|
498
|
+
if (errors === _errs2) {
|
|
499
|
+
if (typeof data0 === "string") {
|
|
500
|
+
if (ucs2length(data0) < 1) {
|
|
501
|
+
validateCreateNoteRequest.errors = [{ instancePath: instancePath + "/title", schemaPath: "#/properties/title/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
502
|
+
return false;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
else {
|
|
506
|
+
validateCreateNoteRequest.errors = [{ instancePath: instancePath + "/title", schemaPath: "#/properties/title/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
var valid0 = _errs2 === errors;
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
var valid0 = true;
|
|
514
|
+
}
|
|
515
|
+
if (valid0) {
|
|
516
|
+
if (data.body !== undefined) {
|
|
517
|
+
let data1 = data.body;
|
|
518
|
+
const _errs4 = errors;
|
|
519
|
+
if (errors === _errs4) {
|
|
520
|
+
if (typeof data1 === "string") {
|
|
521
|
+
if (ucs2length(data1) < 1) {
|
|
522
|
+
validateCreateNoteRequest.errors = [{ instancePath: instancePath + "/body", schemaPath: "#/properties/body/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
else {
|
|
527
|
+
validateCreateNoteRequest.errors = [{ instancePath: instancePath + "/body", schemaPath: "#/properties/body/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
var valid0 = _errs4 === errors;
|
|
532
|
+
}
|
|
533
|
+
else {
|
|
534
|
+
var valid0 = true;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
validateCreateNoteRequest.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
542
|
+
return false;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
validateCreateNoteRequest.errors = vErrors;
|
|
546
|
+
return errors === 0;
|
|
547
|
+
}
|
|
548
|
+
const schema_ExampleTagResponse = { "type": "object", "required": ["id", "name"], "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "php" } } };
|
|
549
|
+
export function validateExampleTagResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
550
|
+
let vErrors = null;
|
|
551
|
+
let errors = 0;
|
|
552
|
+
if (errors === 0) {
|
|
553
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
554
|
+
let missing0;
|
|
555
|
+
if (((data.id === undefined) && (missing0 = "id")) || ((data.name === undefined) && (missing0 = "name"))) {
|
|
556
|
+
validateExampleTagResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
if (data.id !== undefined) {
|
|
561
|
+
let data0 = data.id;
|
|
562
|
+
const _errs1 = errors;
|
|
563
|
+
if (!((typeof data0 == "number") && (!(data0 % 1) && !isNaN(data0)))) {
|
|
564
|
+
validateExampleTagResponse.errors = [{ instancePath: instancePath + "/id", schemaPath: "#/properties/id/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
565
|
+
return false;
|
|
566
|
+
}
|
|
567
|
+
var valid0 = _errs1 === errors;
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
var valid0 = true;
|
|
571
|
+
}
|
|
572
|
+
if (valid0) {
|
|
573
|
+
if (data.name !== undefined) {
|
|
574
|
+
const _errs3 = errors;
|
|
575
|
+
if (typeof data.name !== "string") {
|
|
576
|
+
validateExampleTagResponse.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
577
|
+
return false;
|
|
578
|
+
}
|
|
579
|
+
var valid0 = _errs3 === errors;
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
var valid0 = true;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
validateExampleTagResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
validateExampleTagResponse.errors = vErrors;
|
|
593
|
+
return errors === 0;
|
|
594
|
+
}
|
|
595
|
+
const schema_ExampleTagListResponse = { "type": "object", "required": ["items", "limit", "offset"], "properties": { "items": { "type": "array", "items": { "type": "object", "required": ["id", "name"], "properties": { "id": { "type": "integer", "example": 1 }, "name": { "type": "string", "example": "php" } } } }, "limit": { "type": "integer", "example": 20 }, "offset": { "type": "integer", "example": 0 } } };
|
|
596
|
+
export function validateExampleTagListResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
597
|
+
let vErrors = null;
|
|
598
|
+
let errors = 0;
|
|
599
|
+
if (errors === 0) {
|
|
600
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
601
|
+
let missing0;
|
|
602
|
+
if ((((data.items === undefined) && (missing0 = "items")) || ((data.limit === undefined) && (missing0 = "limit"))) || ((data.offset === undefined) && (missing0 = "offset"))) {
|
|
603
|
+
validateExampleTagListResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
604
|
+
return false;
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
if (data.items !== undefined) {
|
|
608
|
+
let data0 = data.items;
|
|
609
|
+
const _errs1 = errors;
|
|
610
|
+
if (errors === _errs1) {
|
|
611
|
+
if (Array.isArray(data0)) {
|
|
612
|
+
var valid1 = true;
|
|
613
|
+
const len0 = data0.length;
|
|
614
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
615
|
+
let data1 = data0[i0];
|
|
616
|
+
const _errs3 = errors;
|
|
617
|
+
if (errors === _errs3) {
|
|
618
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
619
|
+
let missing1;
|
|
620
|
+
if (((data1.id === undefined) && (missing1 = "id")) || ((data1.name === undefined) && (missing1 = "name"))) {
|
|
621
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/properties/items/items/required", keyword: "required", params: { missingProperty: missing1 }, message: "must have required property '" + missing1 + "'" }];
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
else {
|
|
625
|
+
if (data1.id !== undefined) {
|
|
626
|
+
let data2 = data1.id;
|
|
627
|
+
const _errs5 = errors;
|
|
628
|
+
if (!((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2)))) {
|
|
629
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/items/" + i0 + "/id", schemaPath: "#/properties/items/items/properties/id/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
630
|
+
return false;
|
|
631
|
+
}
|
|
632
|
+
var valid2 = _errs5 === errors;
|
|
633
|
+
}
|
|
634
|
+
else {
|
|
635
|
+
var valid2 = true;
|
|
636
|
+
}
|
|
637
|
+
if (valid2) {
|
|
638
|
+
if (data1.name !== undefined) {
|
|
639
|
+
const _errs7 = errors;
|
|
640
|
+
if (typeof data1.name !== "string") {
|
|
641
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/items/" + i0 + "/name", schemaPath: "#/properties/items/items/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
var valid2 = _errs7 === errors;
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
var valid2 = true;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
else {
|
|
653
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/items/" + i0, schemaPath: "#/properties/items/items/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
654
|
+
return false;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
var valid1 = _errs3 === errors;
|
|
658
|
+
if (!valid1) {
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
else {
|
|
664
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/items", schemaPath: "#/properties/items/type", keyword: "type", params: { type: "array" }, message: "must be array" }];
|
|
665
|
+
return false;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
var valid0 = _errs1 === errors;
|
|
669
|
+
}
|
|
670
|
+
else {
|
|
671
|
+
var valid0 = true;
|
|
672
|
+
}
|
|
673
|
+
if (valid0) {
|
|
674
|
+
if (data.limit !== undefined) {
|
|
675
|
+
let data4 = data.limit;
|
|
676
|
+
const _errs9 = errors;
|
|
677
|
+
if (!((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4)))) {
|
|
678
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/limit", schemaPath: "#/properties/limit/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
679
|
+
return false;
|
|
680
|
+
}
|
|
681
|
+
var valid0 = _errs9 === errors;
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
var valid0 = true;
|
|
685
|
+
}
|
|
686
|
+
if (valid0) {
|
|
687
|
+
if (data.offset !== undefined) {
|
|
688
|
+
let data5 = data.offset;
|
|
689
|
+
const _errs11 = errors;
|
|
690
|
+
if (!((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5)))) {
|
|
691
|
+
validateExampleTagListResponse.errors = [{ instancePath: instancePath + "/offset", schemaPath: "#/properties/offset/type", keyword: "type", params: { type: "integer" }, message: "must be integer" }];
|
|
692
|
+
return false;
|
|
693
|
+
}
|
|
694
|
+
var valid0 = _errs11 === errors;
|
|
695
|
+
}
|
|
696
|
+
else {
|
|
697
|
+
var valid0 = true;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
validateExampleTagListResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
validateExampleTagListResponse.errors = vErrors;
|
|
709
|
+
return errors === 0;
|
|
710
|
+
}
|
|
711
|
+
const schema_CreateTagRequest = { "type": "object", "required": ["name"], "properties": { "name": { "type": "string", "minLength": 1, "example": "php" } }, "additionalProperties": false };
|
|
712
|
+
export function validateCreateTagRequest(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
713
|
+
let vErrors = null;
|
|
714
|
+
let errors = 0;
|
|
715
|
+
if (errors === 0) {
|
|
716
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
717
|
+
let missing0;
|
|
718
|
+
if ((data.name === undefined) && (missing0 = "name")) {
|
|
719
|
+
validateCreateTagRequest.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
720
|
+
return false;
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
const _errs1 = errors;
|
|
724
|
+
for (const key0 in data) {
|
|
725
|
+
if (!(key0 === "name")) {
|
|
726
|
+
validateCreateTagRequest.errors = [{ instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" }];
|
|
727
|
+
return false;
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (_errs1 === errors) {
|
|
732
|
+
if (data.name !== undefined) {
|
|
733
|
+
let data0 = data.name;
|
|
734
|
+
const _errs2 = errors;
|
|
735
|
+
if (errors === _errs2) {
|
|
736
|
+
if (typeof data0 === "string") {
|
|
737
|
+
if (ucs2length(data0) < 1) {
|
|
738
|
+
validateCreateTagRequest.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" }];
|
|
739
|
+
return false;
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
else {
|
|
743
|
+
validateCreateTagRequest.errors = [{ instancePath: instancePath + "/name", schemaPath: "#/properties/name/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
744
|
+
return false;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
else {
|
|
752
|
+
validateCreateTagRequest.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
validateCreateTagRequest.errors = vErrors;
|
|
757
|
+
return errors === 0;
|
|
758
|
+
}
|
|
759
|
+
const schema_ProtectedResponse = { "type": "object", "required": ["message", "claims"], "properties": { "message": { "type": "string", "example": "Welcome, authenticated user." }, "claims": { "type": "object", "additionalProperties": true, "example": { "sub": "user-42", "scope": "read:system" } } } };
|
|
760
|
+
export function validateProtectedResponse(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
761
|
+
let vErrors = null;
|
|
762
|
+
let errors = 0;
|
|
763
|
+
if (errors === 0) {
|
|
764
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
765
|
+
let missing0;
|
|
766
|
+
if (((data.message === undefined) && (missing0 = "message")) || ((data.claims === undefined) && (missing0 = "claims"))) {
|
|
767
|
+
validateProtectedResponse.errors = [{ instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: missing0 }, message: "must have required property '" + missing0 + "'" }];
|
|
768
|
+
return false;
|
|
769
|
+
}
|
|
770
|
+
else {
|
|
771
|
+
if (data.message !== undefined) {
|
|
772
|
+
const _errs1 = errors;
|
|
773
|
+
if (typeof data.message !== "string") {
|
|
774
|
+
validateProtectedResponse.errors = [{ instancePath: instancePath + "/message", schemaPath: "#/properties/message/type", keyword: "type", params: { type: "string" }, message: "must be string" }];
|
|
775
|
+
return false;
|
|
776
|
+
}
|
|
777
|
+
var valid0 = _errs1 === errors;
|
|
778
|
+
}
|
|
779
|
+
else {
|
|
780
|
+
var valid0 = true;
|
|
781
|
+
}
|
|
782
|
+
if (valid0) {
|
|
783
|
+
if (data.claims !== undefined) {
|
|
784
|
+
let data1 = data.claims;
|
|
785
|
+
const _errs3 = errors;
|
|
786
|
+
if (errors === _errs3) {
|
|
787
|
+
if (data1 && typeof data1 == "object" && !Array.isArray(data1)) {
|
|
788
|
+
}
|
|
789
|
+
else {
|
|
790
|
+
validateProtectedResponse.errors = [{ instancePath: instancePath + "/claims", schemaPath: "#/properties/claims/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
791
|
+
return false;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
var valid0 = _errs3 === errors;
|
|
795
|
+
}
|
|
796
|
+
else {
|
|
797
|
+
var valid0 = true;
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
else {
|
|
803
|
+
validateProtectedResponse.errors = [{ instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" }];
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
validateProtectedResponse.errors = vErrors;
|
|
808
|
+
return errors === 0;
|
|
809
|
+
}
|
|
810
|
+
//# sourceMappingURL=guards.js.map
|