diff --git a/lib/bigcommerce/scripts/generate-definitions.js b/lib/bigcommerce/scripts/generate-definitions.js index d3d9d08e6..e41adb711 100644 --- a/lib/bigcommerce/scripts/generate-definitions.js +++ b/lib/bigcommerce/scripts/generate-definitions.js @@ -7,7 +7,8 @@ const path = require('path') const fetch = require('node-fetch') const swaggerToTS = require('@manifoldco/swagger-to-ts').default -async function getSchema(url) { +async function getSchema(filename) { + const url = `https://next-api.stoplight.io/projects/8433/files/${filename}?ref=version%2F1.3` const res = await fetch(url) if (!res.ok) { @@ -18,14 +19,16 @@ async function getSchema(url) { } const schemas = Object.entries({ - '../api/definitions/catalog.ts': - 'https://next-api.stoplight.io/projects/8433/files/BigCommerce_Catalog_API.oas2.yml?ref=version%2F1.3', + '../api/definitions/catalog.ts': 'BigCommerce_Catalog_API.oas2.yml', + // swagger-to-ts is not working for the Cart schema + // '../api/definitions/cart.ts': + // 'BigCommerce_Server_to_Server_Cart_API.oas2.yml', }) async function writeDefinitions() { - const ops = schemas.map(async ([dest, url]) => { + const ops = schemas.map(async ([dest, filename]) => { const destination = path.join(__dirname, dest) - const schema = await getSchema(url) + const schema = await getSchema(filename) const definition = swaggerToTS(schema.content, { prettierConfig: 'package.json', })