From 437ee71312a1640214029ff4df822e4eaf94ce57 Mon Sep 17 00:00:00 2001 From: Casper Kuijjer Date: Sat, 24 May 2025 15:32:15 +0200 Subject: [PATCH 1/3] Use OpenAPI contact information only if there's no businessInformation set --- lib/src/wso2/wso2-api/api-defs.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/src/wso2/wso2-api/api-defs.ts b/lib/src/wso2/wso2-api/api-defs.ts index fe6d504..f8d6173 100644 --- a/lib/src/wso2/wso2-api/api-defs.ts +++ b/lib/src/wso2/wso2-api/api-defs.ts @@ -170,17 +170,20 @@ const applyOpenapiAsDefaults = ( apiDef: Wso2ApiDefinitionV1, ): Wso2ApiDefinitionV1 => { const apiDefr = { ...apiDef }; - // user openapi contact info for business/technical information of the api + // use openapi contact info for business/technical information of the api if ( - (!apiDefr.businessInformation && openapiDocument.info.contact?.email) || - openapiDocument.info.contact?.name + !apiDefr.businessInformation && + (openapiDocument.info.contact?.email || openapiDocument.info.contact?.name) ) { - apiDefr.businessInformation = { - businessOwnerEmail: openapiDocument.info.contact?.email, - technicalOwnerEmail: openapiDocument.info.contact?.email, - technicalOwner: openapiDocument.info.contact?.name, - businessOwner: openapiDocument.info.contact?.name, - }; + apiDefr.businessInformation = {}; + if (openapiDocument.info.contact?.email) { + apiDefr.businessInformation.businessOwnerEmail = openapiDocument.info.contact?.email; + apiDefr.businessInformation.technicalOwnerEmail = openapiDocument.info.contact?.email; + } + if (openapiDocument.info.contact?.name) { + apiDefr.businessInformation.businessOwner = openapiDocument.info.contact?.name; + apiDefr.businessInformation.technicalOwner = openapiDocument.info.contact?.name; + } } if (!apiDefr.description && openapiDocument.info.description) { From 3d77ebf85b44d808e7f0a23b07e096fc85a42d2f Mon Sep 17 00:00:00 2001 From: Casper Kuijjer Date: Sat, 24 May 2025 15:32:36 +0200 Subject: [PATCH 2/3] added prettierrc based on the current formatting of the ts files --- .prettierrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5ac85e2 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "printWidth": 100, + "singleQuote": true +} From 32b4a59237645f6c8e9a7f791f651c7cafd6e46f Mon Sep 17 00:00:00 2001 From: Casper Kuijjer Date: Mon, 26 May 2025 07:57:18 +0200 Subject: [PATCH 3/3] remove .prettierrc, as ESLint can be used instead --- .prettierrc | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index 5ac85e2..0000000 --- a/.prettierrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "printWidth": 100, - "singleQuote": true -}