completecoding / serverless-auto-swagger

80 stars 48 forks source link

typeconv updated #135

Open HeerthanaThiruAcen opened 9 months ago

bfaulk96 commented 6 months ago

typeconv v2 uses ESM, which this repo does not support yet, and I don't have the bandwidth to look into updating it to. If you're able to figure that out, I'm happy to upgrade typeconv

HeerthanaThiruAcen commented 6 months ago

Yeah, After upgrading to typeconv v2, it became apparent that the package no longer supports the 'require' syntax, necessitating the use of 'import' statements instead.

Within the 'dist > ServerlessAutoSwagger.js' file, the original code block: const typeconv_1 = require(typeconv); const packagePath = (0, path_1.dirname)(require.resolve('serverless-auto-swagger/package.json'));

Was replaced with the following code:

` let typeconv_1 = null; import('typeconv') .then((typeconv) => { typeconv_1 = typeconv; }) .catch((error) => { console.error('Error during dynamic import: ', error); });

const packagePath = (0, path_1.dirname)(require.resolve('serverless-auto-swagger-update-typeconv/package.json')); `

The adjustments proved effective, allowing seamless integration. Following the modifications, we proceeded to publish the updated version on our npm account, enabling its utilization to meet our project requirements. For further details, please refer to serverless-auto-swagger-updated-typeconv-esm