@rxap/open-api 18.0.2-dev.2 → 18.0.3-dev.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.
Files changed (131) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/compodoc/changelog.html +848 -0
  4. package/compodoc/classes/OpenApiHttpResponseError.html +456 -0
  5. package/compodoc/classes/RxapOpenApiError.html +313 -0
  6. package/compodoc/classes/SchemaValidationMixin.html +1589 -0
  7. package/compodoc/dependencies.html +215 -0
  8. package/compodoc/fonts/ionicons.eot +0 -0
  9. package/compodoc/fonts/ionicons.svg +2090 -0
  10. package/compodoc/fonts/ionicons.ttf +0 -0
  11. package/compodoc/fonts/ionicons.woff +0 -0
  12. package/compodoc/fonts/ionicons.woff2 +0 -0
  13. package/compodoc/fonts/roboto-v15-latin-300.eot +0 -0
  14. package/compodoc/fonts/roboto-v15-latin-300.svg +314 -0
  15. package/compodoc/fonts/roboto-v15-latin-300.ttf +0 -0
  16. package/compodoc/fonts/roboto-v15-latin-300.woff +0 -0
  17. package/compodoc/fonts/roboto-v15-latin-300.woff2 +0 -0
  18. package/compodoc/fonts/roboto-v15-latin-700.eot +0 -0
  19. package/compodoc/fonts/roboto-v15-latin-700.svg +310 -0
  20. package/compodoc/fonts/roboto-v15-latin-700.ttf +0 -0
  21. package/compodoc/fonts/roboto-v15-latin-700.woff +0 -0
  22. package/compodoc/fonts/roboto-v15-latin-700.woff2 +0 -0
  23. package/compodoc/fonts/roboto-v15-latin-italic.eot +0 -0
  24. package/compodoc/fonts/roboto-v15-latin-italic.svg +323 -0
  25. package/compodoc/fonts/roboto-v15-latin-italic.ttf +0 -0
  26. package/compodoc/fonts/roboto-v15-latin-italic.woff +0 -0
  27. package/compodoc/fonts/roboto-v15-latin-italic.woff2 +0 -0
  28. package/compodoc/fonts/roboto-v15-latin-regular.eot +0 -0
  29. package/compodoc/fonts/roboto-v15-latin-regular.svg +308 -0
  30. package/compodoc/fonts/roboto-v15-latin-regular.ttf +0 -0
  31. package/compodoc/fonts/roboto-v15-latin-regular.woff +0 -0
  32. package/compodoc/fonts/roboto-v15-latin-regular.woff2 +0 -0
  33. package/compodoc/graph/dependencies.svg +24 -0
  34. package/compodoc/images/compodoc-vectorise-inverted.png +0 -0
  35. package/compodoc/images/compodoc-vectorise-inverted.svg +201 -0
  36. package/compodoc/images/compodoc-vectorise.png +0 -0
  37. package/compodoc/images/compodoc-vectorise.svg +201 -0
  38. package/compodoc/images/favicon.ico +0 -0
  39. package/compodoc/index.html +193 -0
  40. package/compodoc/injectables/OpenApiConfigService.html +1289 -0
  41. package/compodoc/interfaces/OpenApiInitOptions.html +395 -0
  42. package/compodoc/interfaces/OpenApiMetaData.html +457 -0
  43. package/compodoc/interfaces/OperationObjectWithMetadata.html +331 -0
  44. package/compodoc/interfaces/SchemaValidationResponse.html +843 -0
  45. package/compodoc/js/compodoc.js +14 -0
  46. package/compodoc/js/lazy-load-graphs.js +44 -0
  47. package/compodoc/js/libs/EventDispatcher.js +5 -0
  48. package/compodoc/js/libs/bootstrap-native.js +2 -0
  49. package/compodoc/js/libs/clipboard.min.js +7 -0
  50. package/compodoc/js/libs/custom-elements-es5-adapter.js +15 -0
  51. package/compodoc/js/libs/custom-elements.min.js +38 -0
  52. package/compodoc/js/libs/d3.v3.min.js +2 -0
  53. package/compodoc/js/libs/deep-iterator.js +2 -0
  54. package/compodoc/js/libs/es6-shim.min.js +12 -0
  55. package/compodoc/js/libs/htmlparser.js +23 -0
  56. package/compodoc/js/libs/innersvg.js +9 -0
  57. package/compodoc/js/libs/lit-html.js +1 -0
  58. package/compodoc/js/libs/prism.js +46 -0
  59. package/compodoc/js/libs/promise.min.js +6 -0
  60. package/compodoc/js/libs/svg-pan-zoom.min.js +3 -0
  61. package/compodoc/js/libs/tablesort.min.js +6 -0
  62. package/compodoc/js/libs/tablesort.number.min.js +6 -0
  63. package/compodoc/js/libs/vis.min.js +47 -0
  64. package/compodoc/js/libs/zepto.min.js +2 -0
  65. package/compodoc/js/menu-wc.js +142 -0
  66. package/compodoc/js/menu-wc_es5.js +40 -0
  67. package/compodoc/js/menu.js +270 -0
  68. package/compodoc/js/routes.js +301 -0
  69. package/compodoc/js/search/lunr.min.js +6 -0
  70. package/compodoc/js/search/search-lunr.js +67 -0
  71. package/compodoc/js/search/search.js +283 -0
  72. package/compodoc/js/search/search_index.js +4 -0
  73. package/compodoc/js/sourceCode.js +58 -0
  74. package/compodoc/js/svg-pan-zoom.controls.js +53 -0
  75. package/compodoc/js/tabs.js +21 -0
  76. package/compodoc/js/tree.js +147 -0
  77. package/compodoc/license.html +731 -0
  78. package/compodoc/miscellaneous/functions.html +530 -0
  79. package/compodoc/miscellaneous/typealiases.html +216 -0
  80. package/compodoc/miscellaneous/variables.html +343 -0
  81. package/compodoc/modules.html +183 -0
  82. package/compodoc/overview.html +209 -0
  83. package/compodoc/properties.html +197 -0
  84. package/compodoc/styles/bootstrap-card.css +219 -0
  85. package/compodoc/styles/bootstrap.min.css +6 -0
  86. package/compodoc/styles/compodoc.css +1124 -0
  87. package/compodoc/styles/dark.css +121 -0
  88. package/compodoc/styles/ionicons.min.css +11 -0
  89. package/compodoc/styles/laravel.css +113 -0
  90. package/compodoc/styles/material.css +131 -0
  91. package/compodoc/styles/original.css +51 -0
  92. package/compodoc/styles/postmark.css +238 -0
  93. package/compodoc/styles/prism.css +301 -0
  94. package/compodoc/styles/readthedocs.css +117 -0
  95. package/compodoc/styles/reset.css +129 -0
  96. package/compodoc/styles/stripe.css +106 -0
  97. package/compodoc/styles/style.css +7 -0
  98. package/compodoc/styles/tablesort.css +33 -0
  99. package/compodoc/styles/vagrant.css +130 -0
  100. package/docs/.nojekyll +1 -0
  101. package/docs/assets/highlight.css +43 -0
  102. package/docs/assets/icons.js +15 -0
  103. package/docs/assets/icons.svg +1 -0
  104. package/docs/assets/main.js +59 -0
  105. package/docs/assets/navigation.js +1 -0
  106. package/docs/assets/search.js +1 -0
  107. package/docs/assets/style.css +1412 -0
  108. package/docs/classes/OpenApiConfigService.html +26 -0
  109. package/docs/classes/OpenApiHttpResponseError.html +21 -0
  110. package/docs/classes/RxapOpenApiError.html +32 -0
  111. package/docs/classes/SchemaValidationMixin.html +17 -0
  112. package/docs/documentation.json +6475 -0
  113. package/docs/functions/AssertOpenApiV3.html +1 -0
  114. package/docs/functions/IsOpenApiV3.html +1 -0
  115. package/docs/functions/IsReferenceObject.html +1 -0
  116. package/docs/functions/NotContainsReferenceObjects.html +1 -0
  117. package/docs/functions/OpenApiInit.html +1 -0
  118. package/docs/index.html +19 -0
  119. package/docs/interfaces/OpenApiInitOptions.html +6 -0
  120. package/docs/interfaces/OpenApiMetaData.html +9 -0
  121. package/docs/interfaces/OperationObjectWithMetadata.html +15 -0
  122. package/docs/interfaces/SchemaValidationResponse.html +5 -0
  123. package/docs/modules.html +21 -0
  124. package/docs/types/OperationMap.html +1 -0
  125. package/docs/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +1 -0
  126. package/docs/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +1 -0
  127. package/docs/variables/DISABLE_SCHEMA_VALIDATION.html +1 -0
  128. package/docs/variables/DISABLE_VALIDATION.html +1 -0
  129. package/docs/variables/RXAP_OPEN_API_CONFIG.html +1 -0
  130. package/docs/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +1 -0
  131. package/package.json +20 -20
@@ -0,0 +1,843 @@
1
+ <!doctype html>
2
+ <html class="no-js" lang="">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
6
+ <title>angular-open-api</title>
7
+ <meta name="description" content="">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+
10
+ <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
11
+ <link rel="stylesheet" href="../styles/style.css">
12
+ <link rel="stylesheet" href="../styles/dark.css">
13
+ </head>
14
+ <body>
15
+ <script>
16
+ // Blocking script to avoid flickering dark mode
17
+ // Dark mode toggle button
18
+ var useDark = window.matchMedia('(prefers-color-scheme: dark)');
19
+ var darkModeState = useDark.matches;
20
+ var $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
21
+ var $darkModeToggles = document.querySelectorAll('.dark-mode-switch');
22
+ var darkModeStateLocal = localStorage.getItem('compodoc_darkmode-state');
23
+
24
+ function checkToggle(check) {
25
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
26
+ $darkModeToggleSwitchers[i].checked = check;
27
+ }
28
+ }
29
+
30
+ function toggleDarkMode(state) {
31
+ if (window.localStorage) {
32
+ localStorage.setItem('compodoc_darkmode-state', state);
33
+ }
34
+
35
+ checkToggle(state);
36
+
37
+ const hasClass = document.body.classList.contains('dark');
38
+
39
+ if (state) {
40
+ for (var i = 0; i < $darkModeToggles.length; i++) {
41
+ $darkModeToggles[i].classList.add('dark');
42
+ }
43
+ if (!hasClass) {
44
+ document.body.classList.add('dark');
45
+ }
46
+ } else {
47
+ for (var i = 0; i < $darkModeToggles.length; i++) {
48
+ $darkModeToggles[i].classList.remove('dark');
49
+ }
50
+ if (hasClass) {
51
+ document.body.classList.remove('dark');
52
+ }
53
+ }
54
+ }
55
+
56
+ useDark.addEventListener('change', function (evt) {
57
+ toggleDarkMode(evt.matches);
58
+ });
59
+ if (darkModeStateLocal) {
60
+ darkModeState = darkModeStateLocal === 'true';
61
+ }
62
+ toggleDarkMode(darkModeState);
63
+ </script>
64
+
65
+ <div class="navbar navbar-default navbar-fixed-top d-md-none p-0">
66
+ <div class="d-flex">
67
+ <a href="../" class="navbar-brand">angular-open-api</a>
68
+ <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
69
+ </div>
70
+ </div>
71
+
72
+ <div class="xs-menu menu" id="mobile-menu">
73
+ <div id="book-search-input" role="search"><input type="text" placeholder="Type to search"></div> <compodoc-menu></compodoc-menu>
74
+ </div>
75
+
76
+ <div class="container-fluid main">
77
+ <div class="row main">
78
+ <div class="d-none d-md-block menu">
79
+ <compodoc-menu mode="normal"></compodoc-menu>
80
+ </div>
81
+ <!-- START CONTENT -->
82
+ <div class="content interface">
83
+ <div class="content-data">
84
+
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <ol class="breadcrumb">
98
+ <li class="breadcrumb-item">Interfaces</li>
99
+ <li class="breadcrumb-item"
100
+ >
101
+ SchemaValidationResponse</li>
102
+ </ol>
103
+
104
+ <ul class="nav nav-tabs" role="tablist">
105
+ <li class="nav-item">
106
+ <a href="#info"
107
+ class="nav-link"
108
+ class="nav-link active"
109
+ role="tab" id="info-tab" data-bs-toggle="tab" data-link="info">Info</a>
110
+ </li>
111
+ <li class="nav-item">
112
+ <a href="#source"
113
+ class="nav-link"
114
+
115
+ role="tab" id="source-tab" data-bs-toggle="tab" data-link="source">Source</a>
116
+ </li>
117
+ </ul>
118
+
119
+ <div class="tab-content">
120
+ <div class="tab-pane fade active in" id="info">
121
+ <p class="comment">
122
+ <h3>File</h3>
123
+ </p>
124
+ <p class="comment">
125
+ <code>src/lib/schema-validation.mixin.ts</code>
126
+ </p>
127
+
128
+
129
+
130
+
131
+ <section data-compodoc="block-index">
132
+ <h3 id="index">Index</h3>
133
+ <table class="table table-sm table-bordered index-table">
134
+ <tbody>
135
+ <tr>
136
+ <td class="col-md-4">
137
+ <h6><b>Properties</b></h6>
138
+ </td>
139
+ </tr>
140
+ <tr>
141
+ <td class="col-md-4">
142
+ <ul class="index-list">
143
+ <li>
144
+ <span class="modifier">Optional</span>
145
+ <a href="#body"
146
+ >
147
+ body
148
+ </a>
149
+ </li>
150
+ <li>
151
+ <span class="modifier">Optional</span>
152
+ <a href="#data"
153
+ >
154
+ data
155
+ </a>
156
+ </li>
157
+ <li>
158
+ <a href="#headers"
159
+ >
160
+ headers
161
+ </a>
162
+ </li>
163
+ <li>
164
+ <a href="#status"
165
+ >
166
+ status
167
+ </a>
168
+ </li>
169
+ </ul>
170
+ </td>
171
+ </tr>
172
+ </tbody>
173
+ </table>
174
+ </section>
175
+
176
+
177
+
178
+ <section data-compodoc="block-properties">
179
+ <h3 id="inputs">Properties</h3>
180
+ <table class="table table-sm table-bordered">
181
+ <tbody>
182
+ <tr>
183
+ <td class="col-md-4">
184
+ <a name="body"></a>
185
+ <span class="name "><b>body</b>
186
+ <a href="#body">
187
+ <span class="icon ion-ios-link"></span>
188
+ </a>
189
+ </span>
190
+ </td>
191
+ </tr>
192
+ <tr>
193
+ <td class="col-md-4">
194
+ <code>body: <code>Data | null</code>
195
+ </code>
196
+ </td>
197
+ </tr>
198
+
199
+
200
+ <tr>
201
+ <td class="col-md-4">
202
+ <i>Type : </i> <code>Data | null</code>
203
+
204
+ </td>
205
+ </tr>
206
+
207
+ <tr>
208
+ <td class="col-md-4">
209
+ <i>Optional</i>
210
+ </td>
211
+ </tr>
212
+
213
+
214
+
215
+
216
+ </tbody>
217
+ </table>
218
+ <table class="table table-sm table-bordered">
219
+ <tbody>
220
+ <tr>
221
+ <td class="col-md-4">
222
+ <a name="data"></a>
223
+ <span class="name "><b>data</b>
224
+ <a href="#data">
225
+ <span class="icon ion-ios-link"></span>
226
+ </a>
227
+ </span>
228
+ </td>
229
+ </tr>
230
+ <tr>
231
+ <td class="col-md-4">
232
+ <code>data: <code>Data</code>
233
+ </code>
234
+ </td>
235
+ </tr>
236
+
237
+
238
+ <tr>
239
+ <td class="col-md-4">
240
+ <i>Type : </i> <code>Data</code>
241
+
242
+ </td>
243
+ </tr>
244
+
245
+ <tr>
246
+ <td class="col-md-4">
247
+ <i>Optional</i>
248
+ </td>
249
+ </tr>
250
+
251
+
252
+
253
+
254
+ </tbody>
255
+ </table>
256
+ <table class="table table-sm table-bordered">
257
+ <tbody>
258
+ <tr>
259
+ <td class="col-md-4">
260
+ <a name="headers"></a>
261
+ <span class="name "><b>headers</b>
262
+ <a href="#headers">
263
+ <span class="icon ion-ios-link"></span>
264
+ </a>
265
+ </span>
266
+ </td>
267
+ </tr>
268
+ <tr>
269
+ <td class="col-md-4">
270
+ <code>headers: <code>HttpHeaders</code>
271
+ </code>
272
+ </td>
273
+ </tr>
274
+
275
+
276
+ <tr>
277
+ <td class="col-md-4">
278
+ <i>Type : </i> <code>HttpHeaders</code>
279
+
280
+ </td>
281
+ </tr>
282
+
283
+
284
+
285
+
286
+
287
+ </tbody>
288
+ </table>
289
+ <table class="table table-sm table-bordered">
290
+ <tbody>
291
+ <tr>
292
+ <td class="col-md-4">
293
+ <a name="status"></a>
294
+ <span class="name "><b>status</b>
295
+ <a href="#status">
296
+ <span class="icon ion-ios-link"></span>
297
+ </a>
298
+ </span>
299
+ </td>
300
+ </tr>
301
+ <tr>
302
+ <td class="col-md-4">
303
+ <code>status: <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
304
+ </code>
305
+ </td>
306
+ </tr>
307
+
308
+
309
+ <tr>
310
+ <td class="col-md-4">
311
+ <i>Type : </i> <code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/number" target="_blank" >number</a></code>
312
+
313
+ </td>
314
+ </tr>
315
+
316
+
317
+
318
+
319
+
320
+ </tbody>
321
+ </table>
322
+ </section>
323
+ </div>
324
+
325
+
326
+ <div class="tab-pane fade tab-source-code" id="source">
327
+ <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { HttpHeaders, HttpParams } from &#x27;@angular/common/http&#x27;;
328
+ import { isDevMode } from &#x27;@angular/core&#x27;;
329
+ import { HttpRemoteMethodParameter } from &#x27;@rxap/remote-method/http&#x27;;
330
+ import {
331
+ coerceArray,
332
+ isPromiseLike,
333
+ IsRecord,
334
+ } from &#x27;@rxap/utilities&#x27;;
335
+ import Ajv from &#x27;ajv&#x27;;
336
+ import { OpenAPIV3 } from &#x27;openapi-types&#x27;;
337
+ import { RxapOpenApiError } from &#x27;./error&#x27;;
338
+ import { OperationObjectWithMetadata } from &#x27;./open-api&#x27;;
339
+ import {
340
+ IsReferenceObject,
341
+ NotContainsReferenceObjects,
342
+ } from &#x27;./utilities&#x27;;
343
+
344
+ export interface SchemaValidationResponse&lt;Data&gt; {
345
+ headers: HttpHeaders;
346
+ status: number;
347
+ body?: Data | null;
348
+ data?: Data;
349
+ }
350
+
351
+ export class SchemaValidationMixin&lt;Response &#x3D; any, Parameters extends Record&lt;string, any&gt; | void &#x3D; any, RequestBody &#x3D; any&gt; {
352
+
353
+ public static STRICT &#x3D; false;
354
+
355
+ protected disableSchemaValidation?: boolean;
356
+
357
+ /**
358
+ * Validates the parameters against the schema specified in the operation object
359
+ *
360
+ * @param operation
361
+ * @param parameters
362
+ * @param strict
363
+ * @protected
364
+ */
365
+ public validateParameters(operation: OperationObjectWithMetadata, parameters?: Parameters, strict &#x3D; false): void {
366
+
367
+ const operationParameters &#x3D; coerceArray(operation.parameters);
368
+
369
+ if (!NotContainsReferenceObjects&lt;OpenAPIV3.ParameterObject&gt;(operationParameters)) {
370
+ throw new RxapOpenApiError(&#x27;The operation parameters contains ReferenceObject!&#x27;);
371
+ }
372
+
373
+ if (parameters &#x3D;&#x3D;&#x3D; undefined) {
374
+ // TODO : find concept to definition witch parameter should not be checked if required
375
+ // header parameters are never required if changes the semantic release manager breaks
376
+ const requiredParameters &#x3D; operationParameters.filter(parameter &#x3D;&gt; parameter.required &amp;&amp;
377
+ parameter.in !&#x3D;&#x3D;
378
+ &#x27;header&#x27;);
379
+ if (requiredParameters.length) {
380
+ if (isDevMode()) {
381
+ console.debug(&#x27;Some operation parameters are required!&#x27;, requiredParameters.map(p &#x3D;&gt; p.name));
382
+ }
383
+ this.validationError(&#x27;Some operation parameters are required!&#x27;, strict);
384
+ }
385
+
386
+ } else if (IsRecord(parameters)) {
387
+
388
+ for (const parameter of operationParameters) {
389
+
390
+ if (parameter.required) {
391
+ // header parameters are never required if changes the semantic release manager breaks
392
+ if (parameter.in !&#x3D;&#x3D; &#x27;header&#x27;) {
393
+ if (!parameters.hasOwnProperty(parameter.name)) {
394
+ this.validationError(&#x60;The operation parameter &#x27;${ parameter.name }&#x27; is required!&#x60;, strict);
395
+ }
396
+ }
397
+ }
398
+
399
+
400
+ if (parameter.schema) {
401
+ if (parameters.hasOwnProperty(parameter.name)) {
402
+
403
+ const value &#x3D; parameters[parameter.name];
404
+
405
+ if (!this.validate(parameter.schema, value)) {
406
+ this.validationError(
407
+ &#x60;The parameter &#x27;${ parameter.name }&#x27; is not valid against the schema!&#x60;,
408
+ strict,
409
+ parameter.schema,
410
+ value,
411
+ );
412
+ }
413
+
414
+ }
415
+ }
416
+
417
+ }
418
+
419
+ } else {
420
+ if (operationParameters.length &#x3D;&#x3D;&#x3D; 0 || operationParameters.every(op &#x3D;&gt; !op.required)) {
421
+ if (isDevMode()) {
422
+ console.warn(
423
+ &#x60;The operation ${ operation.operationId } does not expect any parameters. But a parameter is provided.&#x60;,
424
+ parameters,
425
+ );
426
+ }
427
+ } else {
428
+ throw new Error(&#x27;The parameters object is not a record&#x27;);
429
+ }
430
+ }
431
+
432
+ }
433
+
434
+ /**
435
+ * Validates the http response against the schema specified in the operation object
436
+ *
437
+ * @param operation
438
+ * @param response
439
+ * @param strict
440
+ * @protected
441
+ */
442
+ public validateResponse(
443
+ operation: OperationObjectWithMetadata,
444
+ response: SchemaValidationResponse&lt;Response&gt;,
445
+ strict &#x3D; false,
446
+ ): void {
447
+
448
+ // region only validate the response if the content type is undefined or application/json
449
+
450
+ const contentType &#x3D; response.headers.get(&#x27;Content-Type&#x27;);
451
+
452
+ if (contentType &amp;&amp; contentType !&#x3D;&#x3D; &#x27;application/json&#x27;) {
453
+ if (isDevMode()) {
454
+ console.warn(&#x27;Response validation is only supported for content type application/json&#x27;);
455
+ }
456
+ return;
457
+ }
458
+
459
+ // endregion
460
+
461
+ if (operation.responses) {
462
+
463
+ const status &#x3D; response.status;
464
+
465
+ // region extract the response object based on the response status
466
+ let responseObject: OpenAPIV3.ResponseObject | OpenAPIV3.ReferenceObject | undefined;
467
+
468
+ if (operation.responses[status]) {
469
+ responseObject &#x3D; operation.responses[status];
470
+ } else {
471
+ // use the default response object if no matching was found.
472
+ responseObject &#x3D; operation.responses[&#x27;default&#x27;];
473
+ }
474
+ // endregion
475
+
476
+ if (responseObject) {
477
+
478
+ if (IsReferenceObject(responseObject)) {
479
+ throw new RxapOpenApiError(&#x27;Found a reference object. The operation config is not expand!&#x27;);
480
+ }
481
+
482
+ // region validate the response against the schema if defined
483
+
484
+ // TODO : create schema that validates all parameters at once
485
+
486
+ if (responseObject.content &amp;&amp;
487
+ responseObject.content[&#x27;application/json&#x27;] &amp;&amp;
488
+ responseObject.content[&#x27;application/json&#x27;].schema) {
489
+
490
+ const schema &#x3D; responseObject.content[&#x27;application/json&#x27;].schema;
491
+
492
+ const data &#x3D; response.body ?? response.data;
493
+
494
+ if (!this.validate(schema, data)) {
495
+ this.validationError(&#x27;The response is not valid ageist the operation schema!&#x27;, strict, schema, data);
496
+ }
497
+
498
+ }
499
+
500
+ // endregion
501
+
502
+ }
503
+
504
+
505
+ }
506
+
507
+ }
508
+
509
+ public validateRequestBody(operation: OperationObjectWithMetadata, body?: RequestBody, strict &#x3D; false): void {
510
+
511
+ // only validate body if type of object
512
+ if (typeof body !&#x3D;&#x3D; &#x27;object&#x27;) {
513
+ return;
514
+ }
515
+
516
+ if (operation.requestBody) {
517
+
518
+ if (IsReferenceObject(operation.requestBody)) {
519
+ throw new RxapOpenApiError(&#x27;Found a reference object. The operation config is not expand!&#x27;);
520
+ }
521
+
522
+ if (body &#x3D;&#x3D;&#x3D; undefined &amp;&amp; operation.requestBody.required) {
523
+ this.validationError(&#x27;The request body is required!&#x27;, strict);
524
+ }
525
+
526
+ if (operation.requestBody.content &amp;&amp; operation.requestBody.content[&#x27;application/json&#x27;]) {
527
+
528
+ const schema &#x3D; operation.requestBody.content[&#x27;application/json&#x27;].schema;
529
+
530
+ if (schema) {
531
+ if (!this.validate(schema, body)) {
532
+ this.validationError(&#x27;The request body is not valid!&#x27;, strict, schema, body);
533
+ }
534
+ }
535
+
536
+ }
537
+
538
+ }
539
+
540
+ }
541
+
542
+ public validationError(
543
+ message: string,
544
+ strict: boolean,
545
+ schema?: OpenAPIV3.SchemaObject | OpenAPIV3.ReferenceObject,
546
+ value?: any,
547
+ ) {
548
+ if (isDevMode() &amp;&amp; schema !&#x3D;&#x3D; undefined) {
549
+ console.debug(
550
+ message,
551
+ {
552
+ schema,
553
+ value,
554
+ },
555
+ );
556
+ }
557
+ if (strict || SchemaValidationMixin.STRICT) {
558
+ throw new RxapOpenApiError(message, &#x27;&#x27;, &#x27;SchemaValidationMixin&#x27;);
559
+ } else {
560
+ console.warn(message);
561
+ }
562
+ }
563
+
564
+ public buildHttpParams(
565
+ operationParameters: OpenAPIV3.ParameterObject[],
566
+ parameters?: Parameters,
567
+ ignoreUndefined &#x3D; true,
568
+ ): HttpParams {
569
+
570
+ let params &#x3D; new HttpParams();
571
+
572
+ if (IsRecord(parameters)) {
573
+
574
+ for (const parameter of operationParameters.filter(p &#x3D;&gt; p.in &#x3D;&#x3D;&#x3D; &#x27;query&#x27;)) {
575
+ const parameterName &#x3D; parameter.name;
576
+
577
+ if (parameters.hasOwnProperty(parameter.name)) {
578
+
579
+ const value &#x3D; parameters[parameter.name];
580
+
581
+ if (value &#x3D;&#x3D;&#x3D; undefined &amp;&amp; ignoreUndefined) {
582
+ continue;
583
+ }
584
+
585
+ if (Array.isArray(value)) {
586
+
587
+ if (value.length) {
588
+
589
+ const first &#x3D; value.shift();
590
+
591
+ params &#x3D; params.set(parameterName, typeof first &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(first) : first);
592
+
593
+ for (const item of value) {
594
+ params &#x3D; params.append(parameterName, typeof item &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(item) : item);
595
+ }
596
+
597
+ }
598
+
599
+ } else {
600
+ params &#x3D; params.set(parameter.name, typeof value &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(value) : value);
601
+ }
602
+
603
+ }
604
+
605
+ }
606
+
607
+ }
608
+
609
+ return params;
610
+
611
+ }
612
+
613
+ public buildHttpHeaders(operationParameters: OpenAPIV3.ParameterObject[], parameters?: Parameters): HttpHeaders {
614
+
615
+ let headers &#x3D; new HttpHeaders();
616
+
617
+ if (IsRecord(parameters)) {
618
+
619
+ for (const parameter of operationParameters.filter(p &#x3D;&gt; p.in &#x3D;&#x3D;&#x3D; &#x27;header&#x27;)) {
620
+
621
+ if (parameters.hasOwnProperty(parameter.name)) {
622
+
623
+ const value &#x3D; parameters[parameter.name];
624
+
625
+ if (Array.isArray(value)) {
626
+
627
+ if (value.length) {
628
+
629
+ const first &#x3D; value.shift();
630
+
631
+ headers &#x3D; headers.set(parameters[&#x27;name&#x27;], typeof first &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(first) : first);
632
+
633
+ for (const item of value) {
634
+ headers &#x3D; headers.append(parameters[&#x27;name&#x27;], typeof item &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(item) : item);
635
+ }
636
+
637
+ }
638
+
639
+ } else {
640
+ headers &#x3D; headers.set(parameter.name, typeof value &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ? JSON.stringify(value) : value);
641
+ }
642
+
643
+ }
644
+
645
+ }
646
+
647
+ }
648
+
649
+ return headers;
650
+
651
+ }
652
+
653
+ public buildHttpPathParams(
654
+ operationParameters: OpenAPIV3.ParameterObject[],
655
+ parameters?: Parameters,
656
+ ): Record&lt;string, string&gt; {
657
+
658
+ const pathParams: Record&lt;string, any&gt; &#x3D; {};
659
+
660
+ if (IsRecord(parameters)) {
661
+
662
+ for (const parameter of operationParameters.filter(p &#x3D;&gt; p.in &#x3D;&#x3D;&#x3D; &#x27;path&#x27;)) {
663
+
664
+ if (parameters.hasOwnProperty(parameter.name)) {
665
+ pathParams[parameter.name] &#x3D; encodeURIComponent(typeof parameters[parameter.name] &#x3D;&#x3D;&#x3D; &#x27;object&#x27; ?
666
+ JSON.stringify(parameters[parameter.name]) :
667
+ parameters[parameter.name]);
668
+ }
669
+
670
+ }
671
+
672
+ }
673
+
674
+ return pathParams;
675
+
676
+ }
677
+
678
+ /**
679
+ * Converts open api parameters into the corresponding http options to
680
+ * create a http request. The transformation is guided by the openapi definition
681
+ *
682
+ * @param operation
683
+ * @param parameters
684
+ * @param requestBody
685
+ * @param ignoreUndefined
686
+ */
687
+ public buildHttpOptions(
688
+ operation: OperationObjectWithMetadata,
689
+ parameters?: Parameters,
690
+ requestBody?: RequestBody,
691
+ ignoreUndefined &#x3D; true,
692
+ ): HttpRemoteMethodParameter {
693
+
694
+ const options: HttpRemoteMethodParameter &#x3D; {};
695
+
696
+ const operationParameters &#x3D; coerceArray(operation.parameters);
697
+
698
+ if (!NotContainsReferenceObjects&lt;OpenAPIV3.ParameterObject&gt;(operationParameters)) {
699
+ throw new RxapOpenApiError(&#x27;The operation parameters contains ReferenceObject!&#x27;);
700
+ }
701
+
702
+ const params &#x3D; this.buildHttpParams(operationParameters, parameters, ignoreUndefined);
703
+ const headers &#x3D; this.buildHttpHeaders(operationParameters, parameters);
704
+ const pathParams: Record&lt;string, any&gt; &#x3D; this.buildHttpPathParams(operationParameters, parameters);
705
+
706
+ if (params.keys().length) {
707
+ options.params &#x3D; params;
708
+ }
709
+
710
+ if (headers.keys().length) {
711
+ options.headers &#x3D; headers;
712
+ }
713
+
714
+ if (Object.keys(pathParams).length) {
715
+ options.pathParams &#x3D; pathParams;
716
+ }
717
+
718
+ if (requestBody !&#x3D;&#x3D; undefined) {
719
+ options.body &#x3D; requestBody;
720
+ }
721
+
722
+ return options;
723
+
724
+ }
725
+
726
+ private validate(schema: string | boolean | object, value: any): boolean {
727
+
728
+ if (this.disableSchemaValidation) {
729
+ return true;
730
+ }
731
+
732
+ if (typeof schema !&#x3D;&#x3D; &#x27;object&#x27;) {
733
+ throw new Error(&#x27;The schema must be an object!&#x27;);
734
+ }
735
+
736
+ if (!schema) {
737
+ throw new Error(&#x27;The schema must not be null or undefined!&#x27;);
738
+ }
739
+
740
+ let result: boolean | PromiseLike&lt;any&gt;;
741
+
742
+ const ajv &#x3D; new Ajv();
743
+ const validate &#x3D; ajv.compile(schema);
744
+
745
+ try {
746
+ result &#x3D; validate(value);
747
+ } catch (e: any) {
748
+ console.error(e.message);
749
+ return false;
750
+ }
751
+
752
+ if (isPromiseLike(result)) {
753
+ throw new Error(
754
+ &#x27;Async schema validation is not yet supported. Ensure the all refs in the openapi schema are internal!&#x27;);
755
+ }
756
+
757
+ return result;
758
+ }
759
+
760
+ }
761
+ </code></pre>
762
+ </div>
763
+ </div>
764
+
765
+
766
+
767
+
768
+
769
+
770
+
771
+
772
+ </div><div class="search-results">
773
+ <div class="has-results">
774
+ <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
775
+ <ul class="search-results-list"></ul>
776
+ </div>
777
+ <div class="no-results">
778
+ <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
779
+ </div>
780
+ </div>
781
+ </div>
782
+ <!-- END CONTENT -->
783
+ </div>
784
+ </div>
785
+
786
+ <label class="dark-mode-switch">
787
+ <input type="checkbox">
788
+ <span class="slider">
789
+ <svg class="slider-icon" viewBox="0 0 24 24" fill="none" height="20" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" width="20" xmlns="http://www.w3.org/2000/svg">
790
+ <path d="M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z"></path>
791
+ </svg>
792
+ </span>
793
+ </label>
794
+
795
+ <script>
796
+ var COMPODOC_CURRENT_PAGE_DEPTH = 1;
797
+ var COMPODOC_CURRENT_PAGE_CONTEXT = 'interface';
798
+ var COMPODOC_CURRENT_PAGE_URL = 'SchemaValidationResponse.html';
799
+ var MAX_SEARCH_RESULTS = 15;
800
+ </script>
801
+
802
+ <script>
803
+ $darkModeToggleSwitchers = document.querySelectorAll('.dark-mode-switch input');
804
+ checkToggle(darkModeState);
805
+ if ($darkModeToggleSwitchers.length > 0) {
806
+ for (var i = 0; i < $darkModeToggleSwitchers.length; i++) {
807
+ $darkModeToggleSwitchers[i].addEventListener('change', function (event) {
808
+ darkModeState = !darkModeState;
809
+ toggleDarkMode(darkModeState);
810
+ });
811
+ }
812
+ }
813
+ </script>
814
+
815
+ <script src="../js/libs/custom-elements.min.js"></script>
816
+ <script src="../js/libs/lit-html.js"></script>
817
+
818
+ <script src="../js/menu-wc.js" defer></script>
819
+ <script nomodule src="../js/menu-wc_es5.js" defer></script>
820
+
821
+ <script src="../js/libs/bootstrap-native.js"></script>
822
+
823
+ <script src="../js/libs/es6-shim.min.js"></script>
824
+ <script src="../js/libs/EventDispatcher.js"></script>
825
+ <script src="../js/libs/promise.min.js"></script>
826
+ <script src="../js/libs/zepto.min.js"></script>
827
+
828
+ <script src="../js/compodoc.js"></script>
829
+
830
+ <script src="../js/tabs.js"></script>
831
+ <script src="../js/menu.js"></script>
832
+ <script src="../js/libs/clipboard.min.js"></script>
833
+ <script src="../js/libs/prism.js"></script>
834
+ <script src="../js/sourceCode.js"></script>
835
+ <script src="../js/search/search.js"></script>
836
+ <script src="../js/search/lunr.min.js"></script>
837
+ <script src="../js/search/search-lunr.js"></script>
838
+ <script src="../js/search/search_index.js"></script>
839
+ <script src="../js/lazy-load-graphs.js"></script>
840
+
841
+
842
+ </body>
843
+ </html>