From 44e3161ff9fe18530bd304cd9f3350fd5f4d88b0 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Mon, 10 Jul 2023 16:32:44 +1000 Subject: [PATCH] Update makefile to use default openapi-typescript without transform, drop transform wrapper, and add description for build schema to makefile, so it lists --- Makefile | 4 ++-- client/openapi_to_schema.mjs | 17 ----------------- 2 files changed, 2 insertions(+), 19 deletions(-) delete mode 100644 client/openapi_to_schema.mjs diff --git a/Makefile b/Makefile index 7b413259b3c7..2d7b6fcee8f5 100644 --- a/Makefile +++ b/Makefile @@ -194,8 +194,8 @@ remove-api-schema: rm _shed_schema.yaml update-client-api-schema: client-node-deps build-api-schema - $(IN_VENV) cd client && node openapi_to_schema.mjs ../_schema.yaml > src/api/schema/schema.ts && npx prettier --write src/api/schema/schema.ts - $(IN_VENV) cd client && node openapi_to_schema.mjs ../_shed_schema.yaml > ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && npx prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts + $(IN_VENV) cd client && npx openapi-typescript ../_schema.yaml > src/api/schema/schema.ts && npx prettier --write src/api/schema/schema.ts + $(IN_VENV) cd client && npx openapi-typescript ../_shed_schema.yaml > ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && npx prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts $(MAKE) remove-api-schema lint-api-schema: build-api-schema diff --git a/client/openapi_to_schema.mjs b/client/openapi_to_schema.mjs deleted file mode 100644 index eb6e22a290cc..000000000000 --- a/client/openapi_to_schema.mjs +++ /dev/null @@ -1,17 +0,0 @@ -// this is a helper script that fixes const values -// upstream fix in https://github.com/drwpow/openapi-typescript/pull/1014 -import openapiTS from "openapi-typescript"; - -const inputFilePath = process.argv[2]; - -const localPath = new URL(inputFilePath, import.meta.url); -openapiTS(localPath, { - transform(schemaObject, metadata) { - if ( - "const" in schemaObject && - (typeof schemaObject.const === "string" || schemaObject.const instanceof String) - ) { - return `"${schemaObject.const}"`; - } - }, -}).then((output) => console.log(output));