@eventcatalog/generator-openapi 5.0.3 → 5.0.4
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.js +20 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/dist/types.d.mts +4 -0
- package/dist/types.d.ts +4 -0
- package/dist/types.js.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -376,6 +376,19 @@ async function getSchemasByOperationId(filePath, operationId) {
|
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
+
function getDeprecatedValues(openAPIOperation) {
|
|
380
|
+
const deprecatedDate = openAPIOperation["x-eventcatalog-deprecated-date"] || null;
|
|
381
|
+
const deprecatedMessage = openAPIOperation["x-eventcatalog-deprecated-message"] || null;
|
|
382
|
+
const isNativeDeprecated = openAPIOperation.deprecated;
|
|
383
|
+
let deprecated = isNativeDeprecated;
|
|
384
|
+
if (deprecatedDate) {
|
|
385
|
+
deprecated = {
|
|
386
|
+
date: deprecatedDate,
|
|
387
|
+
message: deprecatedMessage
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
return deprecated;
|
|
391
|
+
}
|
|
379
392
|
async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
380
393
|
try {
|
|
381
394
|
const api = await SwaggerParser.validate(openApiPath);
|
|
@@ -385,6 +398,7 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
385
398
|
for (const method in pathItem) {
|
|
386
399
|
const openAPIOperation = pathItem[method];
|
|
387
400
|
const defaultMessageType = httpMethodsToMessages?.[method.toUpperCase()] || DEFAULT_MESSAGE_TYPE;
|
|
401
|
+
const deprecated = getDeprecatedValues(openAPIOperation);
|
|
388
402
|
const messageType = openAPIOperation["x-eventcatalog-message-type"] || defaultMessageType;
|
|
389
403
|
const messageAction = openAPIOperation["x-eventcatalog-message-action"] === "sends" ? "sends" : "receives";
|
|
390
404
|
const extensions = Object.keys(openAPIOperation).reduce((acc, key) => {
|
|
@@ -403,7 +417,8 @@ async function getOperationsByType(openApiPath, httpMethodsToMessages) {
|
|
|
403
417
|
description: openAPIOperation.description,
|
|
404
418
|
summary: openAPIOperation.summary,
|
|
405
419
|
tags: openAPIOperation.tags || [],
|
|
406
|
-
extensions
|
|
420
|
+
extensions,
|
|
421
|
+
...deprecated ? { deprecated } : {}
|
|
407
422
|
};
|
|
408
423
|
operations.push(operation);
|
|
409
424
|
}
|
|
@@ -554,7 +569,8 @@ var buildMessage = async (pathToFile, document, operation) => {
|
|
|
554
569
|
requestBodiesAndResponses,
|
|
555
570
|
sidebar: {
|
|
556
571
|
badge: httpVerb
|
|
557
|
-
}
|
|
572
|
+
},
|
|
573
|
+
...operation.deprecated ? { deprecated: operation.deprecated } : {}
|
|
558
574
|
};
|
|
559
575
|
};
|
|
560
576
|
|
|
@@ -613,7 +629,7 @@ import chalk from "chalk";
|
|
|
613
629
|
// package.json
|
|
614
630
|
var package_default = {
|
|
615
631
|
name: "@eventcatalog/generator-openapi",
|
|
616
|
-
version: "5.0.
|
|
632
|
+
version: "5.0.4",
|
|
617
633
|
description: "OpenAPI generator for EventCatalog",
|
|
618
634
|
scripts: {
|
|
619
635
|
build: "tsup",
|
|
@@ -649,7 +665,7 @@ var package_default = {
|
|
|
649
665
|
dependencies: {
|
|
650
666
|
"@apidevtools/swagger-parser": "^10.1.0",
|
|
651
667
|
"@changesets/cli": "^2.27.7",
|
|
652
|
-
"@eventcatalog/sdk": "^2.2.
|
|
668
|
+
"@eventcatalog/sdk": "^2.2.6",
|
|
653
669
|
chalk: "^4",
|
|
654
670
|
"js-yaml": "^4.1.0",
|
|
655
671
|
"openapi-types": "^12.1.3",
|