@microsoft/m365-spec-parser 0.2.2-alpha.6e69e41c0.0 → 0.2.2-alpha.7f0eac5b0.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/dist/index.esm2017.js +41 -13
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm2017.mjs +227 -25
- package/dist/index.esm2017.mjs.map +1 -1
- package/dist/index.esm5.js +41 -13
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +227 -25
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/interfaces.d.ts +7 -3
- package/dist/src/specOptimizer.d.ts +18 -0
- package/dist/src/utils.d.ts +5 -4
- package/package.json +3 -3
package/dist/index.esm5.js
CHANGED
|
@@ -286,23 +286,28 @@ class Utils {
|
|
|
286
286
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
287
287
|
}
|
|
288
288
|
static getResponseJson(operationObject, allowMultipleMediaType = false) {
|
|
289
|
-
var _a
|
|
289
|
+
var _a;
|
|
290
290
|
let json = {};
|
|
291
291
|
let multipleMediaType = false;
|
|
292
292
|
for (const code of ConstantString.ResponseCodeFor20X) {
|
|
293
293
|
const responseObject = (_a = operationObject === null || operationObject === void 0 ? void 0 : operationObject.responses) === null || _a === void 0 ? void 0 : _a[code];
|
|
294
|
-
if (
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
294
|
+
if (responseObject === null || responseObject === void 0 ? void 0 : responseObject.content) {
|
|
295
|
+
for (const contentType of Object.keys(responseObject.content)) {
|
|
296
|
+
// json media type can also be "application/json; charset=utf-8"
|
|
297
|
+
if (contentType.indexOf("application/json") >= 0) {
|
|
298
|
+
multipleMediaType = false;
|
|
299
|
+
json = responseObject.content[contentType];
|
|
300
|
+
if (Utils.containMultipleMediaTypes(responseObject)) {
|
|
301
|
+
multipleMediaType = true;
|
|
302
|
+
if (!allowMultipleMediaType) {
|
|
303
|
+
json = {};
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
return { json, multipleMediaType };
|
|
308
|
+
}
|
|
301
309
|
}
|
|
302
310
|
}
|
|
303
|
-
else {
|
|
304
|
-
break;
|
|
305
|
-
}
|
|
306
311
|
}
|
|
307
312
|
}
|
|
308
313
|
return { json, multipleMediaType };
|
|
@@ -562,6 +567,29 @@ class Utils {
|
|
|
562
567
|
const serverUrl = operationServer || methodServer || rootServer;
|
|
563
568
|
return serverUrl;
|
|
564
569
|
}
|
|
570
|
+
static limitACBodyProperties(body, maxCount) {
|
|
571
|
+
const result = [];
|
|
572
|
+
let currentCount = 0;
|
|
573
|
+
for (const element of body) {
|
|
574
|
+
if (element.type === ConstantString.ContainerType) {
|
|
575
|
+
const items = this.limitACBodyProperties(element.items, maxCount - currentCount);
|
|
576
|
+
result.push({
|
|
577
|
+
type: ConstantString.ContainerType,
|
|
578
|
+
$data: element.$data,
|
|
579
|
+
items: items,
|
|
580
|
+
});
|
|
581
|
+
currentCount += items.length;
|
|
582
|
+
}
|
|
583
|
+
else {
|
|
584
|
+
result.push(element);
|
|
585
|
+
currentCount++;
|
|
586
|
+
}
|
|
587
|
+
if (currentCount >= maxCount) {
|
|
588
|
+
break;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
return result;
|
|
592
|
+
}
|
|
565
593
|
}
|
|
566
594
|
|
|
567
595
|
// Copyright (c) Microsoft Corporation.
|
|
@@ -1432,7 +1460,7 @@ class AdaptiveCardGenerator {
|
|
|
1432
1460
|
{
|
|
1433
1461
|
type: "Image",
|
|
1434
1462
|
url: `\${${name}}`,
|
|
1435
|
-
$when: `\${${name} != null}`,
|
|
1463
|
+
$when: `\${${name} != null && ${name} != ''}`,
|
|
1436
1464
|
},
|
|
1437
1465
|
];
|
|
1438
1466
|
}
|
|
@@ -1441,7 +1469,7 @@ class AdaptiveCardGenerator {
|
|
|
1441
1469
|
{
|
|
1442
1470
|
type: "Image",
|
|
1443
1471
|
url: "${$data}",
|
|
1444
|
-
$when: "${$data != null}",
|
|
1472
|
+
$when: "${$data != null && $data != ''}",
|
|
1445
1473
|
},
|
|
1446
1474
|
];
|
|
1447
1475
|
}
|