@rxap/open-api 19.0.0-dev.1 → 19.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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/compodoc/changelog.html +52 -0
- package/compodoc/classes/OpenApiHttpResponseError.html +29 -0
- package/compodoc/classes/SchemaValidationMixin.html +83 -20
- package/compodoc/dependencies.html +14 -14
- package/compodoc/index.html +1 -1
- package/compodoc/interfaces/SchemaValidationResponse.html +65 -2
- package/compodoc/js/menu-wc_es5.js +1 -1
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/properties.html +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/OpenApiConfigService.html +4 -4
- package/docs/classes/OpenApiHttpResponseError.html +8 -7
- package/docs/classes/RxapOpenApiError.html +5 -11
- package/docs/classes/SchemaValidationMixin.html +7 -6
- package/docs/documentation.json +873 -1003
- package/docs/functions/AssertOpenApiV3.html +1 -1
- package/docs/functions/IsOpenApiV3.html +1 -1
- package/docs/functions/IsReferenceObject.html +1 -1
- package/docs/functions/NotContainsReferenceObjects.html +1 -1
- package/docs/functions/OpenApiInit.html +1 -1
- package/docs/index.html +1 -1
- package/docs/interfaces/OpenApiInitOptions.html +3 -3
- package/docs/interfaces/OpenApiMetaData.html +5 -5
- package/docs/interfaces/OperationObjectWithMetadata.html +2 -2
- package/docs/interfaces/SchemaValidationResponse.html +2 -2
- package/docs/types/OperationMap.html +1 -1
- package/docs/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +1 -1
- package/docs/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +1 -1
- package/docs/variables/DISABLE_SCHEMA_VALIDATION.html +1 -1
- package/docs/variables/DISABLE_VALIDATION.html +1 -1
- package/docs/variables/RXAP_OPEN_API_CONFIG.html +1 -1
- package/docs/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +1 -1
- package/package.json +32 -33
- package/theme.css +130 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [19.0.0](https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.0.0-dev.2...@rxap/open-api@19.0.0) (2025-01-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rxap/open-api
|
|
9
|
+
|
|
10
|
+
# [19.0.0-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.0.0-dev.1...@rxap/open-api@19.0.0-dev.2) (2025-01-03)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @rxap/open-api
|
|
13
|
+
|
|
6
14
|
# [19.0.0-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.10-dev.0...@rxap/open-api@19.0.0-dev.1) (2024-12-11)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @rxap/open-api
|
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ yarn add @rxap/open-api
|
|
|
19
19
|
```
|
|
20
20
|
**Install peer dependencies:**
|
|
21
21
|
```bash
|
|
22
|
-
yarn add @angular/common@^
|
|
22
|
+
yarn add @angular/common@^19.0.3 @angular/core@^19.0.3 @rxap/config@^19.0.0 @rxap/data-source@^19.0.0 @rxap/environment@^19.0.0 @rxap/mixin@^16.0.11 @rxap/remote-method@^19.0.0 @rxap/rxjs@^1.1.11 @rxap/utilities@^16.4.1 ajv@^8.12.0 openapi-types@^10.0.0 rxjs@^7.8.1
|
|
23
23
|
```
|
|
24
24
|
**Execute the init generator:**
|
|
25
25
|
```bash
|
package/compodoc/changelog.html
CHANGED
|
@@ -85,6 +85,58 @@
|
|
|
85
85
|
<h1>Change Log</h1>
|
|
86
86
|
<p>All notable changes to this project will be documented in this file.
|
|
87
87
|
See <a href="https://conventionalcommits.org">Conventional Commits</a> for commit guidelines.</p>
|
|
88
|
+
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.0.0-dev.2...@rxap/open-api@19.0.0">19.0.0</a> (2025-01-08)</h1>
|
|
89
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
90
|
+
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.0.0-dev.1...@rxap/open-api@19.0.0-dev.2">19.0.0-dev.2</a> (2025-01-03)</h1>
|
|
91
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
92
|
+
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.10-dev.0...@rxap/open-api@19.0.0-dev.1">19.0.0-dev.1</a> (2024-12-11)</h1>
|
|
93
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
94
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.9...@rxap/open-api@18.0.10-dev.0">18.0.10-dev.0</a> (2024-12-10)</h2>
|
|
95
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
96
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.9-dev.0...@rxap/open-api@18.0.9">18.0.9</a> (2024-12-10)</h2>
|
|
97
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
98
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.8...@rxap/open-api@18.0.9-dev.0">18.0.9-dev.0</a> (2024-10-30)</h2>
|
|
99
|
+
<h3>Bug Fixes</h3>
|
|
100
|
+
<ul>
|
|
101
|
+
<li>remove __archived concept (<a href="https://gitlab.com/rxap/packages/commit/6cd40d605ac0c9d45e2e446ac2424a082a6e004e">6cd40d6</a>)</li>
|
|
102
|
+
</ul>
|
|
103
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.8-dev.2...@rxap/open-api@18.0.8">18.0.8</a> (2024-10-28)</h2>
|
|
104
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
105
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.8-dev.1...@rxap/open-api@18.0.8-dev.2">18.0.8-dev.2</a> (2024-10-25)</h2>
|
|
106
|
+
<h3>Bug Fixes</h3>
|
|
107
|
+
<ul>
|
|
108
|
+
<li>use utility function (<a href="https://gitlab.com/rxap/packages/commit/3cf87c0197971e4f033889ecafc87d615d7a8b02">3cf87c0</a>)</li>
|
|
109
|
+
</ul>
|
|
110
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.8-dev.0...@rxap/open-api@18.0.8-dev.1">18.0.8-dev.1</a> (2024-10-23)</h2>
|
|
111
|
+
<h3>Bug Fixes</h3>
|
|
112
|
+
<ul>
|
|
113
|
+
<li>support other content types then json (<a href="https://gitlab.com/rxap/packages/commit/d3ba7c43bd7d72b853979fd3df69586c7dc33486">d3ba7c4</a>)</li>
|
|
114
|
+
</ul>
|
|
115
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.7...@rxap/open-api@18.0.8-dev.0">18.0.8-dev.0</a> (2024-10-04)</h2>
|
|
116
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
117
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.7-dev.0...@rxap/open-api@18.0.7">18.0.7</a> (2024-09-18)</h2>
|
|
118
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
119
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.6...@rxap/open-api@18.0.7-dev.0">18.0.7-dev.0</a> (2024-08-27)</h2>
|
|
120
|
+
<h3>Bug Fixes</h3>
|
|
121
|
+
<ul>
|
|
122
|
+
<li>add server id getter (<a href="https://gitlab.com/rxap/packages/commit/e9ffaaa736338abeb185a1a78c8d8b6bcd4a5b9a">e9ffaaa</a>)</li>
|
|
123
|
+
</ul>
|
|
124
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.6-dev.0...@rxap/open-api@18.0.6">18.0.6</a> (2024-08-22)</h2>
|
|
125
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
126
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.5...@rxap/open-api@18.0.6-dev.0">18.0.6-dev.0</a> (2024-08-22)</h2>
|
|
127
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
128
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.5-dev.2...@rxap/open-api@18.0.5">18.0.5</a> (2024-07-30)</h2>
|
|
129
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
130
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.5-dev.1...@rxap/open-api@18.0.5-dev.2">18.0.5-dev.2</a> (2024-07-25)</h2>
|
|
131
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
132
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.5-dev.0...@rxap/open-api@18.0.5-dev.1">18.0.5-dev.1</a> (2024-07-09)</h2>
|
|
133
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
134
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.4...@rxap/open-api@18.0.5-dev.0">18.0.5-dev.0</a> (2024-07-03)</h2>
|
|
135
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
136
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.4-dev.0...@rxap/open-api@18.0.4">18.0.4</a> (2024-06-30)</h2>
|
|
137
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
138
|
+
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.3...@rxap/open-api@18.0.4-dev.0">18.0.4-dev.0</a> (2024-06-30)</h2>
|
|
139
|
+
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
88
140
|
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.3-dev.1...@rxap/open-api@18.0.3">18.0.3</a> (2024-06-28)</h2>
|
|
89
141
|
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
90
142
|
<h2><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@18.0.3-dev.0...@rxap/open-api@18.0.3-dev.1">18.0.3-dev.1</a> (2024-06-21)</h2>
|
|
@@ -175,6 +175,9 @@
|
|
|
175
175
|
<li>
|
|
176
176
|
<a href="#operationId" >operationId</a>
|
|
177
177
|
</li>
|
|
178
|
+
<li>
|
|
179
|
+
<a href="#serverId" >serverId</a>
|
|
180
|
+
</li>
|
|
178
181
|
</ul>
|
|
179
182
|
</td>
|
|
180
183
|
</tr>
|
|
@@ -338,6 +341,28 @@
|
|
|
338
341
|
|
|
339
342
|
</tbody>
|
|
340
343
|
</table>
|
|
344
|
+
<table class="table table-sm table-bordered">
|
|
345
|
+
<tbody>
|
|
346
|
+
<tr>
|
|
347
|
+
<td class="col-md-4">
|
|
348
|
+
<a name="serverId"></a>
|
|
349
|
+
<span class="name"><b>serverId</b><a href="#serverId"><span class="icon ion-ios-link"></span></a></span>
|
|
350
|
+
</td>
|
|
351
|
+
</tr>
|
|
352
|
+
|
|
353
|
+
<tr>
|
|
354
|
+
<td class="col-md-4">
|
|
355
|
+
<span class="accessor"><b>get</b><code>serverId()</code></span>
|
|
356
|
+
</td>
|
|
357
|
+
</tr>
|
|
358
|
+
<tr>
|
|
359
|
+
<td class="col-md-4">
|
|
360
|
+
<div class="io-line">Defined in <a href="" data-line="27" class="link-to-prism">src/lib/open-api-http-response.error.ts:27</a></div>
|
|
361
|
+
</td>
|
|
362
|
+
</tr>
|
|
363
|
+
|
|
364
|
+
</tbody>
|
|
365
|
+
</table>
|
|
341
366
|
</section>
|
|
342
367
|
</div>
|
|
343
368
|
|
|
@@ -369,6 +394,10 @@ export class OpenApiHttpResponseError extends HttpErrorResponse {
|
|
|
369
394
|
return this.metadata.id;
|
|
370
395
|
}
|
|
371
396
|
|
|
397
|
+
get serverId() {
|
|
398
|
+
return this.metadata.serverId;
|
|
399
|
+
}
|
|
400
|
+
|
|
372
401
|
}
|
|
373
402
|
</code></pre>
|
|
374
403
|
</div>
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
</tr>
|
|
232
232
|
<tr>
|
|
233
233
|
<td class="col-md-4">
|
|
234
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
234
|
+
<div class="io-line">Defined in <a href="" data-line="35" class="link-to-prism">src/lib/schema-validation.mixin.ts:35</a></div>
|
|
235
235
|
</td>
|
|
236
236
|
</tr>
|
|
237
237
|
|
|
@@ -257,7 +257,7 @@
|
|
|
257
257
|
</tr>
|
|
258
258
|
<tr>
|
|
259
259
|
<td class="col-md-4">
|
|
260
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
260
|
+
<div class="io-line">Defined in <a href="" data-line="33" class="link-to-prism">src/lib/schema-validation.mixin.ts:33</a></div>
|
|
261
261
|
</td>
|
|
262
262
|
</tr>
|
|
263
263
|
|
|
@@ -293,8 +293,8 @@
|
|
|
293
293
|
|
|
294
294
|
<tr>
|
|
295
295
|
<td class="col-md-4">
|
|
296
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
297
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
296
|
+
<div class="io-line">Defined in <a href="" data-line="293"
|
|
297
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:293</a></div>
|
|
298
298
|
</td>
|
|
299
299
|
</tr>
|
|
300
300
|
|
|
@@ -374,8 +374,8 @@
|
|
|
374
374
|
|
|
375
375
|
<tr>
|
|
376
376
|
<td class="col-md-4">
|
|
377
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
378
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
377
|
+
<div class="io-line">Defined in <a href="" data-line="367"
|
|
378
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:367</a></div>
|
|
379
379
|
</td>
|
|
380
380
|
</tr>
|
|
381
381
|
|
|
@@ -491,8 +491,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
491
491
|
|
|
492
492
|
<tr>
|
|
493
493
|
<td class="col-md-4">
|
|
494
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
495
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
494
|
+
<div class="io-line">Defined in <a href="" data-line="244"
|
|
495
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:244</a></div>
|
|
496
496
|
</td>
|
|
497
497
|
</tr>
|
|
498
498
|
|
|
@@ -591,8 +591,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
591
591
|
|
|
592
592
|
<tr>
|
|
593
593
|
<td class="col-md-4">
|
|
594
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
595
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
594
|
+
<div class="io-line">Defined in <a href="" data-line="333"
|
|
595
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:333</a></div>
|
|
596
596
|
</td>
|
|
597
597
|
</tr>
|
|
598
598
|
|
|
@@ -672,8 +672,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
672
672
|
|
|
673
673
|
<tr>
|
|
674
674
|
<td class="col-md-4">
|
|
675
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
676
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
675
|
+
<div class="io-line">Defined in <a href="" data-line="45"
|
|
676
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:45</a></div>
|
|
677
677
|
</td>
|
|
678
678
|
</tr>
|
|
679
679
|
|
|
@@ -774,8 +774,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
774
774
|
|
|
775
775
|
<tr>
|
|
776
776
|
<td class="col-md-4">
|
|
777
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
778
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
777
|
+
<div class="io-line">Defined in <a href="" data-line="189"
|
|
778
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:189</a></div>
|
|
779
779
|
</td>
|
|
780
780
|
</tr>
|
|
781
781
|
|
|
@@ -874,8 +874,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
874
874
|
|
|
875
875
|
<tr>
|
|
876
876
|
<td class="col-md-4">
|
|
877
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
878
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
877
|
+
<div class="io-line">Defined in <a href="" data-line="122"
|
|
878
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:122</a></div>
|
|
879
879
|
</td>
|
|
880
880
|
</tr>
|
|
881
881
|
|
|
@@ -976,8 +976,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
976
976
|
|
|
977
977
|
<tr>
|
|
978
978
|
<td class="col-md-4">
|
|
979
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
980
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
979
|
+
<div class="io-line">Defined in <a href="" data-line="222"
|
|
980
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:222</a></div>
|
|
981
981
|
</td>
|
|
982
982
|
</tr>
|
|
983
983
|
|
|
@@ -1069,10 +1069,14 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
1069
1069
|
|
|
1070
1070
|
|
|
1071
1071
|
<div class="tab-pane fade tab-source-code" id="source">
|
|
1072
|
-
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
|
|
1072
|
+
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
|
|
1073
|
+
HttpHeaders,
|
|
1074
|
+
HttpParams,
|
|
1075
|
+
} from '@angular/common/http';
|
|
1073
1076
|
import { isDevMode } from '@angular/core';
|
|
1074
1077
|
import { HttpRemoteMethodParameter } from '@rxap/remote-method/http';
|
|
1075
1078
|
import {
|
|
1079
|
+
assertsObject,
|
|
1076
1080
|
coerceArray,
|
|
1077
1081
|
isPromiseLike,
|
|
1078
1082
|
IsRecord,
|
|
@@ -1093,6 +1097,8 @@ export interface SchemaValidationResponse<Data> {
|
|
|
1093
1097
|
data?: Data;
|
|
1094
1098
|
}
|
|
1095
1099
|
|
|
1100
|
+
|
|
1101
|
+
|
|
1096
1102
|
export class SchemaValidationMixin<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any> {
|
|
1097
1103
|
|
|
1098
1104
|
public static STRICT = false;
|
|
@@ -1461,13 +1467,70 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
1461
1467
|
}
|
|
1462
1468
|
|
|
1463
1469
|
if (requestBody !== undefined) {
|
|
1464
|
-
|
|
1470
|
+
const [ body, contentType ] = this.buildBody(operation, requestBody);
|
|
1471
|
+
if (body !== undefined) {
|
|
1472
|
+
options.body = body;
|
|
1473
|
+
if (contentType !== undefined) {
|
|
1474
|
+
options.headers ??= new HttpHeaders();
|
|
1475
|
+
options.headers.set('Content-Type', contentType);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1465
1478
|
}
|
|
1466
1479
|
|
|
1467
1480
|
return options;
|
|
1468
1481
|
|
|
1469
1482
|
}
|
|
1470
1483
|
|
|
1484
|
+
private buildBody(operation: OperationObjectWithMetadata, requestBody: RequestBody): [ any, string | undefined ] {
|
|
1485
|
+
const accept: string[] = [];
|
|
1486
|
+
if (operation.requestBody && !IsReferenceObject(operation.requestBody)) {
|
|
1487
|
+
if (operation.requestBody.content) {
|
|
1488
|
+
for (const contentType of Object.keys(operation.requestBody.content)) {
|
|
1489
|
+
accept.push(contentType);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
if (!accept.length) {
|
|
1494
|
+
console.warn('No content type found for the request body! Omitting the body!');
|
|
1495
|
+
return [ undefined, undefined ];
|
|
1496
|
+
}
|
|
1497
|
+
if (accept.length > 1) {
|
|
1498
|
+
console.warn('Multiple content types found for the request body! Using the first one!');
|
|
1499
|
+
}
|
|
1500
|
+
const contentType = accept[0];
|
|
1501
|
+
switch (contentType) {
|
|
1502
|
+
|
|
1503
|
+
case 'application/json':
|
|
1504
|
+
assertsObject(requestBody);
|
|
1505
|
+
return [ requestBody, contentType ];
|
|
1506
|
+
|
|
1507
|
+
case 'application/x-www-form-urlencoded':
|
|
1508
|
+
assertsObject(requestBody);
|
|
1509
|
+
// eslint-disable-next-line no-case-declarations
|
|
1510
|
+
let params = new HttpParams();
|
|
1511
|
+
for (const [ key, value ] of Object.entries(requestBody)) {
|
|
1512
|
+
params = params.set(key, value);
|
|
1513
|
+
}
|
|
1514
|
+
return [ params.toString(), contentType ];
|
|
1515
|
+
|
|
1516
|
+
case 'multipart/form-data':
|
|
1517
|
+
assertsObject(requestBody);
|
|
1518
|
+
// eslint-disable-next-line no-case-declarations
|
|
1519
|
+
const formData = new FormData();
|
|
1520
|
+
|
|
1521
|
+
// Iterate through the JSON object and append each field to FormData
|
|
1522
|
+
for (const [ key, value ] of Object.entries(requestBody)) {
|
|
1523
|
+
formData.append(key, value);
|
|
1524
|
+
}
|
|
1525
|
+
return [ formData, contentType ];
|
|
1526
|
+
|
|
1527
|
+
default:
|
|
1528
|
+
return [ requestBody, contentType ];
|
|
1529
|
+
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1471
1534
|
private validate(schema: string | boolean | object, value: any): boolean {
|
|
1472
1535
|
|
|
1473
1536
|
if (this.disableSchemaValidation) {
|
|
@@ -101,11 +101,7 @@
|
|
|
101
101
|
</ol>
|
|
102
102
|
<ul class="dependencies-list">
|
|
103
103
|
<li>
|
|
104
|
-
<b>@nx/devkit</b> :
|
|
105
|
-
<li>
|
|
106
|
-
<b>ajv</b> : 8.12.0</li>
|
|
107
|
-
<li>
|
|
108
|
-
<b>openapi-types</b> : ^10.0.0</li>
|
|
104
|
+
<b>@nx/devkit</b> : 20.3.1</li>
|
|
109
105
|
<li>
|
|
110
106
|
<b>tslib</b> : 2.6.2</li>
|
|
111
107
|
</ul>
|
|
@@ -117,23 +113,27 @@
|
|
|
117
113
|
</ol>
|
|
118
114
|
<ul class="dependencies-list">
|
|
119
115
|
<li>
|
|
120
|
-
<b>@angular/common</b> : ^
|
|
116
|
+
<b>@angular/common</b> : ^19.0.3</li>
|
|
121
117
|
<li>
|
|
122
|
-
<b>@angular/core</b> : ^
|
|
118
|
+
<b>@angular/core</b> : ^19.0.3</li>
|
|
123
119
|
<li>
|
|
124
|
-
<b>@rxap/config</b> : ^
|
|
120
|
+
<b>@rxap/config</b> : ^19.0.0</li>
|
|
125
121
|
<li>
|
|
126
|
-
<b>@rxap/data-source</b> : ^
|
|
122
|
+
<b>@rxap/data-source</b> : ^19.0.0</li>
|
|
127
123
|
<li>
|
|
128
|
-
<b>@rxap/environment</b> : ^
|
|
124
|
+
<b>@rxap/environment</b> : ^19.0.0</li>
|
|
129
125
|
<li>
|
|
130
|
-
<b>@rxap/mixin</b> : ^16.0.
|
|
126
|
+
<b>@rxap/mixin</b> : ^16.0.11</li>
|
|
131
127
|
<li>
|
|
132
|
-
<b>@rxap/remote-method</b> : ^
|
|
128
|
+
<b>@rxap/remote-method</b> : ^19.0.0</li>
|
|
133
129
|
<li>
|
|
134
|
-
<b>@rxap/rxjs</b> : ^1.1.
|
|
130
|
+
<b>@rxap/rxjs</b> : ^1.1.11</li>
|
|
135
131
|
<li>
|
|
136
|
-
<b>@rxap/utilities</b> : ^16.
|
|
132
|
+
<b>@rxap/utilities</b> : ^16.4.1</li>
|
|
133
|
+
<li>
|
|
134
|
+
<b>ajv</b> : ^8.12.0</li>
|
|
135
|
+
<li>
|
|
136
|
+
<b>openapi-types</b> : ^10.0.0</li>
|
|
137
137
|
<li>
|
|
138
138
|
<b>rxjs</b> : ^7.8.1</li>
|
|
139
139
|
</ul>
|
package/compodoc/index.html
CHANGED
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
<h1>Installation</h1>
|
|
100
100
|
<p><strong>Add the package to your workspace:</strong></p>
|
|
101
101
|
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @rxap/open-api</code></pre></div><p><strong>Install peer dependencies:</strong></p>
|
|
102
|
-
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @angular/common@^
|
|
102
|
+
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn add @angular/common@^19.0.3 @angular/core@^19.0.3 @rxap/config@^19.0.0 @rxap/data-source@^19.0.0 @rxap/environment@^19.0.0 @rxap/mixin@^16.0.11 @rxap/remote-method@^19.0.0 @rxap/rxjs@^1.1.11 @rxap/utilities@^16.4.1 ajv@^8.12.0 openapi-types@^10.0.0 rxjs@^7.8.1 </code></pre></div><p><strong>Execute the init generator:</strong></p>
|
|
103
103
|
<b>Example :</b><div><pre class="line-numbers"><code class="language-bash">yarn nx g @rxap/open-api:init</code></pre></div><h1>Generators</h1>
|
|
104
104
|
<h2>init</h2>
|
|
105
105
|
<blockquote>
|
|
@@ -324,10 +324,14 @@
|
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
<div class="tab-pane fade tab-source-code" id="source">
|
|
327
|
-
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
|
|
327
|
+
<pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import {
|
|
328
|
+
HttpHeaders,
|
|
329
|
+
HttpParams,
|
|
330
|
+
} from '@angular/common/http';
|
|
328
331
|
import { isDevMode } from '@angular/core';
|
|
329
332
|
import { HttpRemoteMethodParameter } from '@rxap/remote-method/http';
|
|
330
333
|
import {
|
|
334
|
+
assertsObject,
|
|
331
335
|
coerceArray,
|
|
332
336
|
isPromiseLike,
|
|
333
337
|
IsRecord,
|
|
@@ -348,6 +352,8 @@ export interface SchemaValidationResponse<Data> {
|
|
|
348
352
|
data?: Data;
|
|
349
353
|
}
|
|
350
354
|
|
|
355
|
+
|
|
356
|
+
|
|
351
357
|
export class SchemaValidationMixin<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any> {
|
|
352
358
|
|
|
353
359
|
public static STRICT = false;
|
|
@@ -716,13 +722,70 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
716
722
|
}
|
|
717
723
|
|
|
718
724
|
if (requestBody !== undefined) {
|
|
719
|
-
|
|
725
|
+
const [ body, contentType ] = this.buildBody(operation, requestBody);
|
|
726
|
+
if (body !== undefined) {
|
|
727
|
+
options.body = body;
|
|
728
|
+
if (contentType !== undefined) {
|
|
729
|
+
options.headers ??= new HttpHeaders();
|
|
730
|
+
options.headers.set('Content-Type', contentType);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
720
733
|
}
|
|
721
734
|
|
|
722
735
|
return options;
|
|
723
736
|
|
|
724
737
|
}
|
|
725
738
|
|
|
739
|
+
private buildBody(operation: OperationObjectWithMetadata, requestBody: RequestBody): [ any, string | undefined ] {
|
|
740
|
+
const accept: string[] = [];
|
|
741
|
+
if (operation.requestBody && !IsReferenceObject(operation.requestBody)) {
|
|
742
|
+
if (operation.requestBody.content) {
|
|
743
|
+
for (const contentType of Object.keys(operation.requestBody.content)) {
|
|
744
|
+
accept.push(contentType);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (!accept.length) {
|
|
749
|
+
console.warn('No content type found for the request body! Omitting the body!');
|
|
750
|
+
return [ undefined, undefined ];
|
|
751
|
+
}
|
|
752
|
+
if (accept.length > 1) {
|
|
753
|
+
console.warn('Multiple content types found for the request body! Using the first one!');
|
|
754
|
+
}
|
|
755
|
+
const contentType = accept[0];
|
|
756
|
+
switch (contentType) {
|
|
757
|
+
|
|
758
|
+
case 'application/json':
|
|
759
|
+
assertsObject(requestBody);
|
|
760
|
+
return [ requestBody, contentType ];
|
|
761
|
+
|
|
762
|
+
case 'application/x-www-form-urlencoded':
|
|
763
|
+
assertsObject(requestBody);
|
|
764
|
+
// eslint-disable-next-line no-case-declarations
|
|
765
|
+
let params = new HttpParams();
|
|
766
|
+
for (const [ key, value ] of Object.entries(requestBody)) {
|
|
767
|
+
params = params.set(key, value);
|
|
768
|
+
}
|
|
769
|
+
return [ params.toString(), contentType ];
|
|
770
|
+
|
|
771
|
+
case 'multipart/form-data':
|
|
772
|
+
assertsObject(requestBody);
|
|
773
|
+
// eslint-disable-next-line no-case-declarations
|
|
774
|
+
const formData = new FormData();
|
|
775
|
+
|
|
776
|
+
// Iterate through the JSON object and append each field to FormData
|
|
777
|
+
for (const [ key, value ] of Object.entries(requestBody)) {
|
|
778
|
+
formData.append(key, value);
|
|
779
|
+
}
|
|
780
|
+
return [ formData, contentType ];
|
|
781
|
+
|
|
782
|
+
default:
|
|
783
|
+
return [ requestBody, contentType ];
|
|
784
|
+
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
}
|
|
788
|
+
|
|
726
789
|
private validate(schema: string | boolean | object, value: any): boolean {
|
|
727
790
|
|
|
728
791
|
if (this.disableSchemaValidation) {
|