Browse Source

refactor: move swagger.json to nocodb package

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/5174/head
Pranav C 2 years ago
parent
commit
adb1dcfddf
  1. 6
      .github/workflows/publish-api-docs.yml
  2. 4
      packages/nocodb-sdk/package.json
  3. 2
      packages/nocodb/src/lib/meta/api/helpers/apiHelpers.ts
  4. 0
      packages/nocodb/src/schema/swagger.json
  5. 3
      packages/nocodb/tsconfig.json

6
.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'

4
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
}
}
}

2
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);

0
scripts/sdk/swagger.json → packages/nocodb/src/schema/swagger.json

3
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/**",

Loading…
Cancel
Save