@rxap/open-api 19.2.0 → 19.3.0-dev.1
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 +12 -0
- package/compodoc/changelog.html +10 -0
- package/compodoc/classes/SchemaValidationMixin.html +37 -32
- package/compodoc/dependencies.html +6 -6
- package/compodoc/interfaces/SchemaValidationResponse.html +17 -12
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/miscellaneous/functions.html +223 -0
- package/compodoc/miscellaneous/variables.html +146 -0
- package/compodoc/properties.html +1 -1
- package/docs/documentation.json +1367 -592
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/classes/OpenApiConfigService.html +3 -3
- package/docs/html/classes/OpenApiHttpResponseError.html +4 -4
- package/docs/html/classes/RxapOpenApiError.html +5 -5
- package/docs/html/classes/SchemaValidationMixin.html +5 -5
- package/docs/html/functions/AssertOpenApiV3.html +1 -1
- package/docs/html/functions/IsOpenApiV3.html +1 -1
- package/docs/html/functions/IsReferenceObject.html +1 -1
- package/docs/html/functions/NotContainsReferenceObjects.html +1 -1
- package/docs/html/functions/OpenApiInit.html +1 -1
- package/docs/html/functions/getJsonContentSchema.html +1 -0
- package/docs/html/functions/getJsonSchema.html +1 -0
- package/docs/html/functions/hasJsonContentSchema.html +1 -0
- package/docs/html/functions/hasJsonSchema.html +1 -0
- package/docs/html/functions/injectOpenApiBaseUrlHttpInterceptorFn.html +1 -0
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/OpenApiInitOptions.html +3 -3
- package/docs/html/interfaces/OpenApiMetaData.html +5 -5
- package/docs/html/interfaces/OperationObjectWithMetadata.html +2 -2
- package/docs/html/interfaces/SchemaValidationResponse.html +2 -2
- package/docs/html/modules.html +1 -1
- package/docs/html/types/OperationMap.html +1 -1
- package/docs/html/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +1 -1
- package/docs/html/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +1 -1
- package/docs/html/variables/DISABLE_SCHEMA_VALIDATION.html +1 -1
- package/docs/html/variables/DISABLE_VALIDATION.html +1 -1
- package/docs/html/variables/OPEN_API_OPERATION.html +1 -0
- package/docs/html/variables/OPEN_API_OPERATION_ID.html +1 -0
- package/docs/html/variables/OPEN_API_SERVER_ID.html +1 -0
- package/docs/html/variables/OPEN_API_SERVER_INDEX.html +1 -0
- package/docs/html/variables/RXAP_OPEN_API_CONFIG.html +1 -1
- package/docs/html/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +1 -1
- package/docs/markdown/README.md +1 -1
- package/docs/markdown/classes/OpenApiConfigService.md +14 -14
- package/docs/markdown/classes/OpenApiHttpResponseError.md +7 -7
- package/docs/markdown/classes/RxapOpenApiError.md +13 -13
- package/docs/markdown/classes/SchemaValidationMixin.md +13 -13
- package/docs/markdown/functions/AssertOpenApiV3.md +2 -2
- package/docs/markdown/functions/IsOpenApiV3.md +2 -2
- package/docs/markdown/functions/IsReferenceObject.md +2 -2
- package/docs/markdown/functions/NotContainsReferenceObjects.md +2 -2
- package/docs/markdown/functions/OpenApiInit.md +2 -2
- package/docs/markdown/functions/getJsonContentSchema.md +21 -0
- package/docs/markdown/functions/getJsonSchema.md +21 -0
- package/docs/markdown/functions/hasJsonContentSchema.md +25 -0
- package/docs/markdown/functions/hasJsonSchema.md +21 -0
- package/docs/markdown/functions/injectOpenApiBaseUrlHttpInterceptorFn.md +25 -0
- package/docs/markdown/globals.md +11 -2
- package/docs/markdown/interfaces/OpenApiInitOptions.md +4 -4
- package/docs/markdown/interfaces/OpenApiMetaData.md +7 -7
- package/docs/markdown/interfaces/OperationObjectWithMetadata.md +4 -4
- package/docs/markdown/interfaces/SchemaValidationResponse.md +6 -6
- package/docs/markdown/type-aliases/OperationMap.md +2 -2
- package/docs/markdown/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +2 -2
- package/docs/markdown/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +2 -2
- package/docs/markdown/variables/DISABLE_SCHEMA_VALIDATION.md +2 -2
- package/docs/markdown/variables/DISABLE_VALIDATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION.md +11 -0
- package/docs/markdown/variables/OPEN_API_OPERATION_ID.md +11 -0
- package/docs/markdown/variables/OPEN_API_SERVER_ID.md +11 -0
- package/docs/markdown/variables/OPEN_API_SERVER_INDEX.md +11 -0
- package/docs/markdown/variables/RXAP_OPEN_API_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_STRICT_VALIDATOR.md +2 -2
- package/docs/wiki/Class.OpenApiConfigService.md +13 -13
- package/docs/wiki/Class.OpenApiHttpResponseError.md +6 -6
- package/docs/wiki/Class.RxapOpenApiError.md +12 -12
- package/docs/wiki/Class.SchemaValidationMixin.md +12 -12
- package/docs/wiki/Function.AssertOpenApiV3.md +1 -1
- package/docs/wiki/Function.IsOpenApiV3.md +1 -1
- package/docs/wiki/Function.IsReferenceObject.md +1 -1
- package/docs/wiki/Function.NotContainsReferenceObjects.md +1 -1
- package/docs/wiki/Function.OpenApiInit.md +1 -1
- package/docs/wiki/Function.getJsonContentSchema.md +17 -0
- package/docs/wiki/Function.getJsonSchema.md +17 -0
- package/docs/wiki/Function.hasJsonContentSchema.md +21 -0
- package/docs/wiki/Function.hasJsonSchema.md +17 -0
- package/docs/wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn.md +21 -0
- package/docs/wiki/Interface.OpenApiInitOptions.md +3 -3
- package/docs/wiki/Interface.OpenApiMetaData.md +6 -6
- package/docs/wiki/Interface.OperationObjectWithMetadata.md +3 -3
- package/docs/wiki/Interface.SchemaValidationResponse.md +5 -5
- package/docs/wiki/TypeAlias.OperationMap.md +1 -1
- package/docs/wiki/Variable.DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +1 -1
- package/docs/wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +1 -1
- package/docs/wiki/Variable.DISABLE_SCHEMA_VALIDATION.md +1 -1
- package/docs/wiki/Variable.DISABLE_VALIDATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION.md +7 -0
- package/docs/wiki/Variable.OPEN_API_OPERATION_ID.md +7 -0
- package/docs/wiki/Variable.OPEN_API_SERVER_ID.md +7 -0
- package/docs/wiki/Variable.OPEN_API_SERVER_INDEX.md +7 -0
- package/docs/wiki/Variable.RXAP_OPEN_API_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_STRICT_VALIDATOR.md +1 -1
- package/docs/wiki/_Sidebar.md +9 -0
- package/docs/wiki/globals.md +10 -1
- package/fesm2022/rxap-open-api-http-resource.mjs +8 -16
- package/fesm2022/rxap-open-api-http-resource.mjs.map +1 -1
- package/fesm2022/rxap-open-api-remote-method.mjs +6 -2
- package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
- package/fesm2022/rxap-open-api.mjs +70 -15
- package/fesm2022/rxap-open-api.mjs.map +1 -1
- package/http-resource/lib/http-context-tokens.d.ts +4 -4
- package/http-resource/lib/http-interceptors.d.ts +4 -2
- package/index.d.ts +2 -0
- package/lib/http-context-tokens.d.ts +5 -0
- package/lib/http-interceptors.d.ts +2 -0
- package/lib/utilities.d.ts +6 -0
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
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.3.0-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.3.0-dev.0...@rxap/open-api@19.3.0-dev.1) (2026-03-31)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **open-api:** improve JSON schema validation and content type handling ([ac3d728](https://gitlab.com/rxap/packages/commit/ac3d7285320f12c0a107c3336dcbc8001ff09bb2))
|
|
11
|
+
|
|
12
|
+
# [19.3.0-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.2.0...@rxap/open-api@19.3.0-dev.0) (2026-03-31)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- **open-api:** add HttpContext-based request customization and updated interceptors ([ffe3576](https://gitlab.com/rxap/packages/commit/ffe357668b9f48e1a662bd95b09ee37b875de5bd))
|
|
17
|
+
|
|
6
18
|
# [19.2.0](https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.2.0-dev.4...@rxap/open-api@19.2.0) (2026-01-23)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @rxap/open-api
|
package/compodoc/changelog.html
CHANGED
|
@@ -85,6 +85,16 @@
|
|
|
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.3.0-dev.0...@rxap/open-api@19.3.0-dev.1">19.3.0-dev.1</a> (2026-03-31)</h1>
|
|
89
|
+
<h3>Features</h3>
|
|
90
|
+
<ul>
|
|
91
|
+
<li><strong>open-api:</strong> improve JSON schema validation and content type handling (<a href="https://gitlab.com/rxap/packages/commit/ac3d7285320f12c0a107c3336dcbc8001ff09bb2">ac3d728</a>)</li>
|
|
92
|
+
</ul>
|
|
93
|
+
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.2.0...@rxap/open-api@19.3.0-dev.0">19.3.0-dev.0</a> (2026-03-31)</h1>
|
|
94
|
+
<h3>Features</h3>
|
|
95
|
+
<ul>
|
|
96
|
+
<li><strong>open-api:</strong> add HttpContext-based request customization and updated interceptors (<a href="https://gitlab.com/rxap/packages/commit/ffe357668b9f48e1a662bd95b09ee37b875de5bd">ffe3576</a>)</li>
|
|
97
|
+
</ul>
|
|
88
98
|
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.2.0-dev.4...@rxap/open-api@19.2.0">19.2.0</a> (2026-01-23)</h1>
|
|
89
99
|
<p><strong>Note:</strong> Version bump only for package @rxap/open-api</p>
|
|
90
100
|
<h1><a href="https://gitlab.com/rxap/packages/compare/@rxap/open-api@19.2.0-dev.3...@rxap/open-api@19.2.0-dev.4">19.2.0-dev.4</a> (2025-12-08)</h1>
|
|
@@ -235,7 +235,7 @@
|
|
|
235
235
|
</tr>
|
|
236
236
|
<tr>
|
|
237
237
|
<td class="col-md-4">
|
|
238
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
238
|
+
<div class="io-line">Defined in <a href="" data-line="37" class="link-to-prism">src/lib/schema-validation.mixin.ts:37</a></div>
|
|
239
239
|
</td>
|
|
240
240
|
</tr>
|
|
241
241
|
|
|
@@ -261,7 +261,7 @@
|
|
|
261
261
|
</tr>
|
|
262
262
|
<tr>
|
|
263
263
|
<td class="col-md-4">
|
|
264
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
264
|
+
<div class="io-line">Defined in <a href="" data-line="35" class="link-to-prism">src/lib/schema-validation.mixin.ts:35</a></div>
|
|
265
265
|
</td>
|
|
266
266
|
</tr>
|
|
267
267
|
|
|
@@ -297,8 +297,8 @@
|
|
|
297
297
|
|
|
298
298
|
<tr>
|
|
299
299
|
<td class="col-md-4">
|
|
300
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
301
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
300
|
+
<div class="io-line">Defined in <a href="" data-line="297"
|
|
301
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:297</a></div>
|
|
302
302
|
</td>
|
|
303
303
|
</tr>
|
|
304
304
|
|
|
@@ -378,8 +378,8 @@
|
|
|
378
378
|
|
|
379
379
|
<tr>
|
|
380
380
|
<td class="col-md-4">
|
|
381
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
382
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
381
|
+
<div class="io-line">Defined in <a href="" data-line="381"
|
|
382
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:381</a></div>
|
|
383
383
|
</td>
|
|
384
384
|
</tr>
|
|
385
385
|
|
|
@@ -495,8 +495,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
495
495
|
|
|
496
496
|
<tr>
|
|
497
497
|
<td class="col-md-4">
|
|
498
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
499
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
498
|
+
<div class="io-line">Defined in <a href="" data-line="248"
|
|
499
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:248</a></div>
|
|
500
500
|
</td>
|
|
501
501
|
</tr>
|
|
502
502
|
|
|
@@ -595,8 +595,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
595
595
|
|
|
596
596
|
<tr>
|
|
597
597
|
<td class="col-md-4">
|
|
598
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
599
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
598
|
+
<div class="io-line">Defined in <a href="" data-line="332"
|
|
599
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:332</a></div>
|
|
600
600
|
</td>
|
|
601
601
|
</tr>
|
|
602
602
|
|
|
@@ -676,8 +676,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
676
676
|
|
|
677
677
|
<tr>
|
|
678
678
|
<td class="col-md-4">
|
|
679
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
680
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
679
|
+
<div class="io-line">Defined in <a href="" data-line="355"
|
|
680
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:355</a></div>
|
|
681
681
|
</td>
|
|
682
682
|
</tr>
|
|
683
683
|
|
|
@@ -757,8 +757,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
757
757
|
|
|
758
758
|
<tr>
|
|
759
759
|
<td class="col-md-4">
|
|
760
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
761
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
760
|
+
<div class="io-line">Defined in <a href="" data-line="47"
|
|
761
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:47</a></div>
|
|
762
762
|
</td>
|
|
763
763
|
</tr>
|
|
764
764
|
|
|
@@ -859,8 +859,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
859
859
|
|
|
860
860
|
<tr>
|
|
861
861
|
<td class="col-md-4">
|
|
862
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
863
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
862
|
+
<div class="io-line">Defined in <a href="" data-line="193"
|
|
863
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:193</a></div>
|
|
864
864
|
</td>
|
|
865
865
|
</tr>
|
|
866
866
|
|
|
@@ -959,8 +959,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
959
959
|
|
|
960
960
|
<tr>
|
|
961
961
|
<td class="col-md-4">
|
|
962
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
963
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
962
|
+
<div class="io-line">Defined in <a href="" data-line="124"
|
|
963
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:124</a></div>
|
|
964
964
|
</td>
|
|
965
965
|
</tr>
|
|
966
966
|
|
|
@@ -1061,8 +1061,8 @@ create a http request. The transformation is guided by the openapi definition</p
|
|
|
1061
1061
|
|
|
1062
1062
|
<tr>
|
|
1063
1063
|
<td class="col-md-4">
|
|
1064
|
-
<div class="io-line">Defined in <a href="" data-line="
|
|
1065
|
-
class="link-to-prism">src/lib/schema-validation.mixin.ts:
|
|
1064
|
+
<div class="io-line">Defined in <a href="" data-line="226"
|
|
1065
|
+
class="link-to-prism">src/lib/schema-validation.mixin.ts:226</a></div>
|
|
1066
1066
|
</td>
|
|
1067
1067
|
</tr>
|
|
1068
1068
|
|
|
@@ -1171,6 +1171,8 @@ import { OpenAPIV3 } from 'openapi-types';
|
|
|
1171
1171
|
import { RxapOpenApiError } from './error';
|
|
1172
1172
|
import { OperationObjectWithMetadata } from './open-api';
|
|
1173
1173
|
import {
|
|
1174
|
+
getJsonContentSchema,
|
|
1175
|
+
hasJsonContentSchema,
|
|
1174
1176
|
IsReferenceObject,
|
|
1175
1177
|
NotContainsReferenceObjects,
|
|
1176
1178
|
} from './utilities';
|
|
@@ -1281,13 +1283,13 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
1281
1283
|
strict = false,
|
|
1282
1284
|
): void {
|
|
1283
1285
|
|
|
1284
|
-
// region only validate the response if the content type is undefined or
|
|
1286
|
+
// region only validate the response if the content type is undefined or json like
|
|
1285
1287
|
|
|
1286
1288
|
const contentType = response.headers.get('Content-Type');
|
|
1287
1289
|
|
|
1288
|
-
if (contentType && contentType
|
|
1290
|
+
if (contentType && contentType.match(/^application\/(.+\+)?json/)) {
|
|
1289
1291
|
if (isDevMode()) {
|
|
1290
|
-
console.warn('Response validation is only supported for content
|
|
1292
|
+
console.warn('Response validation is only supported for content types that are json like.');
|
|
1291
1293
|
}
|
|
1292
1294
|
return;
|
|
1293
1295
|
}
|
|
@@ -1319,16 +1321,18 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
1319
1321
|
|
|
1320
1322
|
// TODO : create schema that validates all parameters at once
|
|
1321
1323
|
|
|
1322
|
-
if (responseObject
|
|
1323
|
-
|
|
1324
|
-
|
|
1324
|
+
if (hasJsonContentSchema(responseObject)) {
|
|
1325
|
+
|
|
1326
|
+
const schema = getJsonContentSchema(responseObject);
|
|
1325
1327
|
|
|
1326
|
-
|
|
1328
|
+
if (schema) {
|
|
1327
1329
|
|
|
1328
|
-
|
|
1330
|
+
const data = response.body ?? response.data;
|
|
1331
|
+
|
|
1332
|
+
if (!this.validate(schema, data)) {
|
|
1333
|
+
this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
|
|
1334
|
+
}
|
|
1329
1335
|
|
|
1330
|
-
if (!this.validate(schema, data)) {
|
|
1331
|
-
this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
|
|
1332
1336
|
}
|
|
1333
1337
|
|
|
1334
1338
|
}
|
|
@@ -1359,9 +1363,9 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
1359
1363
|
this.validationError('The request body is required!', strict);
|
|
1360
1364
|
}
|
|
1361
1365
|
|
|
1362
|
-
if (operation.requestBody
|
|
1366
|
+
if (hasJsonContentSchema(operation.requestBody)) {
|
|
1363
1367
|
|
|
1364
|
-
const schema = operation.requestBody
|
|
1368
|
+
const schema = getJsonContentSchema(operation.requestBody);
|
|
1365
1369
|
|
|
1366
1370
|
if (schema) {
|
|
1367
1371
|
if (!this.validate(schema, body)) {
|
|
@@ -1596,6 +1600,7 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
1596
1600
|
switch (contentType) {
|
|
1597
1601
|
|
|
1598
1602
|
case 'application/json':
|
|
1603
|
+
case 'application/ld+json':
|
|
1599
1604
|
assertsObject(requestBody);
|
|
1600
1605
|
return [ requestBody, contentType ];
|
|
1601
1606
|
|
|
@@ -117,19 +117,19 @@
|
|
|
117
117
|
<li>
|
|
118
118
|
<b>@angular/core</b> : ^19.2.1</li>
|
|
119
119
|
<li>
|
|
120
|
-
<b>@rxap/config</b> : ^19.
|
|
120
|
+
<b>@rxap/config</b> : ^19.3.0-dev.0</li>
|
|
121
121
|
<li>
|
|
122
|
-
<b>@rxap/data-source</b> : ^19.1.1
|
|
122
|
+
<b>@rxap/data-source</b> : ^19.1.1</li>
|
|
123
123
|
<li>
|
|
124
|
-
<b>@rxap/environment</b> : ^19.1.0
|
|
124
|
+
<b>@rxap/environment</b> : ^19.1.0</li>
|
|
125
125
|
<li>
|
|
126
|
-
<b>@rxap/mixin</b> : ^16.0.
|
|
126
|
+
<b>@rxap/mixin</b> : ^16.0.16-dev.0</li>
|
|
127
127
|
<li>
|
|
128
|
-
<b>@rxap/remote-method</b> : ^19.
|
|
128
|
+
<b>@rxap/remote-method</b> : ^19.2.0-dev.0</li>
|
|
129
129
|
<li>
|
|
130
130
|
<b>@rxap/rxjs</b> : ^1.1.16</li>
|
|
131
131
|
<li>
|
|
132
|
-
<b>@rxap/utilities</b> : ^16.5.
|
|
132
|
+
<b>@rxap/utilities</b> : ^16.5.1-dev.0</li>
|
|
133
133
|
<li>
|
|
134
134
|
<b>ajv</b> : ^8.12.0</li>
|
|
135
135
|
<li>
|
|
@@ -341,6 +341,8 @@ import { OpenAPIV3 } from 'openapi-types';
|
|
|
341
341
|
import { RxapOpenApiError } from './error';
|
|
342
342
|
import { OperationObjectWithMetadata } from './open-api';
|
|
343
343
|
import {
|
|
344
|
+
getJsonContentSchema,
|
|
345
|
+
hasJsonContentSchema,
|
|
344
346
|
IsReferenceObject,
|
|
345
347
|
NotContainsReferenceObjects,
|
|
346
348
|
} from './utilities';
|
|
@@ -451,13 +453,13 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
451
453
|
strict = false,
|
|
452
454
|
): void {
|
|
453
455
|
|
|
454
|
-
// region only validate the response if the content type is undefined or
|
|
456
|
+
// region only validate the response if the content type is undefined or json like
|
|
455
457
|
|
|
456
458
|
const contentType = response.headers.get('Content-Type');
|
|
457
459
|
|
|
458
|
-
if (contentType && contentType
|
|
460
|
+
if (contentType && contentType.match(/^application\/(.+\+)?json/)) {
|
|
459
461
|
if (isDevMode()) {
|
|
460
|
-
console.warn('Response validation is only supported for content
|
|
462
|
+
console.warn('Response validation is only supported for content types that are json like.');
|
|
461
463
|
}
|
|
462
464
|
return;
|
|
463
465
|
}
|
|
@@ -489,16 +491,18 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
489
491
|
|
|
490
492
|
// TODO : create schema that validates all parameters at once
|
|
491
493
|
|
|
492
|
-
if (responseObject
|
|
493
|
-
responseObject.content['application/json'] &&
|
|
494
|
-
responseObject.content['application/json'].schema) {
|
|
494
|
+
if (hasJsonContentSchema(responseObject)) {
|
|
495
495
|
|
|
496
|
-
const schema = responseObject
|
|
496
|
+
const schema = getJsonContentSchema(responseObject);
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
if (schema) {
|
|
499
|
+
|
|
500
|
+
const data = response.body ?? response.data;
|
|
501
|
+
|
|
502
|
+
if (!this.validate(schema, data)) {
|
|
503
|
+
this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
|
|
504
|
+
}
|
|
499
505
|
|
|
500
|
-
if (!this.validate(schema, data)) {
|
|
501
|
-
this.validationError('The response is not valid ageist the operation schema!', strict, schema, data);
|
|
502
506
|
}
|
|
503
507
|
|
|
504
508
|
}
|
|
@@ -529,9 +533,9 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
529
533
|
this.validationError('The request body is required!', strict);
|
|
530
534
|
}
|
|
531
535
|
|
|
532
|
-
if (operation.requestBody
|
|
536
|
+
if (hasJsonContentSchema(operation.requestBody)) {
|
|
533
537
|
|
|
534
|
-
const schema = operation.requestBody
|
|
538
|
+
const schema = getJsonContentSchema(operation.requestBody);
|
|
535
539
|
|
|
536
540
|
if (schema) {
|
|
537
541
|
if (!this.validate(schema, body)) {
|
|
@@ -766,6 +770,7 @@ export class SchemaValidationMixin<Response = any, Parameters extends Re
|
|
|
766
770
|
switch (contentType) {
|
|
767
771
|
|
|
768
772
|
case 'application/json':
|
|
773
|
+
case 'application/ld+json':
|
|
769
774
|
assertsObject(requestBody);
|
|
770
775
|
return [ requestBody, contentType ];
|
|
771
776
|
|