From adb1dcfddfcf674403e45a140370050713416a14 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sun, 26 Feb 2023 13:20:40 +0530 Subject: [PATCH] refactor: move swagger.json to nocodb package Signed-off-by: Pranav C --- .github/workflows/publish-api-docs.yml | 6 +++--- packages/nocodb-sdk/package.json | 4 ++-- packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts | 2 +- {scripts/sdk => packages/nocodb/src/schema}/swagger.json | 0 packages/nocodb/tsconfig.json | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) rename {scripts/sdk => packages/nocodb/src/schema}/swagger.json (100%) diff --git a/.github/workflows/publish-api-docs.yml b/.github/workflows/publish-api-docs.yml index e54cd12976..47860cdd7f 100644 --- a/.github/workflows/publish-api-docs.yml +++ b/.github/workflows/publish-api-docs.yml @@ -4,7 +4,7 @@ on: push: branches: [ master ] paths: - - "scripts/sdk/swagger.json" + - "packages/nocodb/src/schema/swagger.json" release: types: [ published ] @@ -22,7 +22,7 @@ jobs: env: API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }} with: - source_file: 'scripts/sdk/swagger.json' + source_file: 'packages/nocodb/src/schema/swagger.json' destination_repo: 'nocodb/noco-apis-doc' destination_folder: 'src' user_email: 'oof1lab@gmail.com' @@ -34,7 +34,7 @@ jobs: env: API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }} with: - source_file: 'scripts/sdk/swagger.json' + source_file: 'packages/nocodb/src/schema/swagger.json' destination_repo: 'nocodb/noco-apis-doc' destination_folder: 'meta-src' user_email: 'oof1lab@gmail.com' diff --git a/packages/nocodb-sdk/package.json b/packages/nocodb-sdk/package.json index ec22d9e676..df6fab6c5e 100644 --- a/packages/nocodb-sdk/package.json +++ b/packages/nocodb-sdk/package.json @@ -31,7 +31,7 @@ "test:prettier": "prettier \"src/**/*.ts\" --list-different", "test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"", "watch:build": "tsc -p tsconfig.json -w", - "generate:sdk": "npx --yes swagger-typescript-api@10.0.3 -r -p ../../scripts/sdk/swagger.json -o ./src/lib/ --axios --unwrap-response-data --module-name-first-tag --type-suffix=Type --templates ../../scripts/sdk/templates" + "generate:sdk": "npx --yes swagger-typescript-api@10.0.3 -r -p ../../packages/nocodb/src/schema/swagger.json -o ./src/lib/ --axios --unwrap-response-data --module-name-first-tag --type-suffix=Type --templates ../../scripts/sdk/templates" }, "dependencies": { "axios": "^0.21.1", @@ -63,4 +63,4 @@ "prettier": { "singleQuote": true } -} \ No newline at end of file +} diff --git a/packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts b/packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts index fe4438b1f2..49d1fbc462 100644 --- a/packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts +++ b/packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts @@ -1,7 +1,7 @@ import { NextFunction, Request, Response } from 'express'; import Ajv, { ErrorObject } from 'ajv'; // @ts-ignore -import swagger from '../../../../../../../scripts/sdk/swagger.json'; +import swagger from '../../../../schema/swagger.json'; export function parseHrtimeToSeconds(hrtime) { const seconds = (hrtime[0] + hrtime[1] / 1e6).toFixed(3); diff --git a/scripts/sdk/swagger.json b/packages/nocodb/src/schema/swagger.json similarity index 100% rename from scripts/sdk/swagger.json rename to packages/nocodb/src/schema/swagger.json diff --git a/packages/nocodb/tsconfig.json b/packages/nocodb/tsconfig.json index ff49fbac9c..0a94f925a7 100644 --- a/packages/nocodb/tsconfig.json +++ b/packages/nocodb/tsconfig.json @@ -58,8 +58,7 @@ "include": [ "src/**/*.ts", // "src/lib/xgene/migrations/*.js", - "src/**/*.json", - "../../scripts/sdk/swagger.json" + "src/**/*.json" ], "exclude": [ "node_modules/**",