Skip to content

Commit 629fe0c

Browse files
committed
feat: adding async API server definition
Signed-off-by: Pawel Psztyc <[email protected]>
1 parent c0880cd commit 629fe0c

File tree

5 files changed

+223
-60
lines changed

5 files changed

+223
-60
lines changed

package-lock.json

Lines changed: 136 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@api-components/amf-helper-mixin",
33
"description": "A mixin with common functions user by most AMF components to compute AMF values",
4-
"version": "4.5.4",
4+
"version": "4.5.5",
55
"license": "Apache-2.0",
66
"main": "index.js",
77
"module": "index.js",
@@ -32,8 +32,8 @@
3232
"@api-components/api-model-generator": "^0.2.14",
3333
"@open-wc/eslint-config": "^4.3.0",
3434
"@open-wc/testing": "^2.5.33",
35-
"@web/dev-server": "^0.1.23",
36-
"@web/test-runner": "^0.13.17",
35+
"@web/dev-server": "^0.1.24",
36+
"@web/test-runner": "^0.13.18",
3737
"@web/test-runner-playwright": "^0.8.8",
3838
"eslint": "^7.32.0",
3939
"eslint-config-prettier": "^8.3.0",

src/AmfSerializer.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,18 @@ export class AmfSerializer extends AmfHelperMixin(Object) {
127127
if (Array.isArray(variables) && variables.length) {
128128
result.variables = variables.map((p) => this.parameter(p));
129129
}
130+
const protocol = /** @type string */ (this._getValue(object, this.ns.aml.vocabularies.apiContract.protocol));
131+
const protocolVersion = /** @type string */ (this._getValue(object, this.ns.aml.vocabularies.apiContract.protocolVersion));
132+
if (protocol) {
133+
result.protocol = protocol;
134+
}
135+
if (protocolVersion) {
136+
result.protocolVersion = protocolVersion;
137+
}
138+
const security = /** @type SecurityRequirement */ (object[this._getAmfKey(this.ns.aml.vocabularies.security.security)]);
139+
if (Array.isArray(security) && security.length) {
140+
result.security = security.map((p) => this.securityRequirement(p));
141+
}
130142
return result;
131143
}
132144

src/types.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export interface ApiServer extends ApiDomainProperty {
107107
description?: string;
108108
variables: ApiParameter[];
109109
sourceMaps?: ApiDocumentSourceMaps;
110+
protocol?: string;
111+
protocolVersion?: string;
112+
security?: ApiSecurityRequirement[];
110113
}
111114

112115
export interface ApiParameter extends ApiDomainProperty {

0 commit comments

Comments
 (0)