From eabaa635f3df88ca3a0870bd28734e9947f66cf3 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 25 Feb 2023 18:11:01 +0530 Subject: [PATCH] fix: use newly added schema in swagger apis Signed-off-by: Pranav C --- packages/nocodb-sdk/src/lib/Api.ts | 84 +++++++----------- scripts/sdk/swagger.json | 137 ++++++++--------------------- 2 files changed, 65 insertions(+), 156 deletions(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index ad1b387925..1e361669c5 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -1053,13 +1053,7 @@ export class Api< * @response `401` `void` Unauthorized * @response `403` `void` Forbidden */ - signup: ( - data: { - email?: string; - password?: string; - }, - params: RequestParams = {} - ) => + signup: (data: SignUpReqType, params: RequestParams = {}) => this.request< { token?: string; @@ -1091,13 +1085,7 @@ export class Api< }` Bad Request */ - signin: ( - data: { - email: string; - password: string; - }, - params: RequestParams = {} - ) => + signin: (data: SignInReqType, params: RequestParams = {}) => this.request< { token?: string; @@ -1148,12 +1136,7 @@ export class Api< * @response `200` `void` OK * @response `401` `void` Unauthorized */ - passwordForgot: ( - data: { - email?: string; - }, - params: RequestParams = {} - ) => + passwordForgot: (data: ForgotPasswordReqType, params: RequestParams = {}) => this.request({ path: `/api/v1/auth/password/forgot`, method: 'POST', @@ -1178,13 +1161,7 @@ export class Api< }` Bad request */ - passwordChange: ( - data: { - currentPassword?: string; - newPassword?: string; - }, - params: RequestParams = {} - ) => + passwordChange: (data: PasswordChangeReqType, params: RequestParams = {}) => this.request< { msg?: string; @@ -1244,9 +1221,7 @@ export class Api< */ passwordReset: ( token: string, - data: { - new_password?: string; - }, + data: PasswordResetReqType, params: RequestParams = {} ) => this.request({ @@ -1498,12 +1473,7 @@ export class Api< * @request POST:/api/v1/license * @response `200` `void` OK */ - set: ( - data: { - key?: string; - }, - params: RequestParams = {} - ) => + set: (data: LicenseReqType, params: RequestParams = {}) => this.request({ path: `/api/v1/license`, method: 'POST', @@ -1761,14 +1731,14 @@ export class Api< * @tags Project * @name ModelVisibilitySet * @request POST:/api/v1/db/meta/projects/{projectId}/visibility-rules - * @response `200` `any` OK + * @response `200` `VisibilityRuleReqType` OK */ modelVisibilitySet: ( projectId: string, data: any, params: RequestParams = {} ) => - this.request({ + this.request({ path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`, method: 'POST', body: data, @@ -2612,7 +2582,11 @@ export class Api< * @request POST:/api/v1/db/meta/tables/{tableId}/grids * @response `200` `GridType` OK */ - gridCreate: (tableId: string, data: GridType, params: RequestParams = {}) => + gridCreate: ( + tableId: string, + data: GridReqType, + params: RequestParams = {} + ) => this.request({ path: `/api/v1/db/meta/tables/${tableId}/grids`, method: 'POST', @@ -2630,7 +2604,11 @@ export class Api< * @request POST:/api/v1/db/meta/tables/{tableId}/forms * @response `200` `FormType` OK */ - formCreate: (tableId: string, data: FormType, params: RequestParams = {}) => + formCreate: ( + tableId: string, + data: FormReqType, + params: RequestParams = {} + ) => this.request({ path: `/api/v1/db/meta/tables/${tableId}/forms`, method: 'POST', @@ -2761,7 +2739,7 @@ export class Api< */ galleryCreate: ( tableId: string, - data: GalleryType, + data: GalleryReqType, params: RequestParams = {} ) => this.request({ @@ -2783,7 +2761,7 @@ export class Api< */ galleryUpdate: ( galleryId: string, - data: GalleryType, + data: GalleryReqType, params: RequestParams = {} ) => this.request({ @@ -2820,7 +2798,7 @@ export class Api< */ kanbanCreate: ( tableId: string, - data: KanbanType, + data: KanbanReqType, params: RequestParams = {} ) => this.request({ @@ -2842,7 +2820,7 @@ export class Api< */ kanbanUpdate: ( kanbanId: string, - data: KanbanType, + data: KanbanUpdateReqType, params: RequestParams = {} ) => this.request({ @@ -3182,7 +3160,7 @@ export class Api< * @request POST:/api/v1/db/meta/views/{viewId}/filters * @response `200` `FilterType` OK */ - create: (viewId: string, data: FilterType, params: RequestParams = {}) => + create: (viewId: string, data: FilterReqType, params: RequestParams = {}) => this.request({ path: `/api/v1/db/meta/views/${viewId}/filters`, method: 'POST', @@ -3216,7 +3194,11 @@ export class Api< * @request PATCH:/api/v1/db/meta/filters/{filterId} * @response `200` `void` OK */ - update: (filterId: string, data: FilterType, params: RequestParams = {}) => + update: ( + filterId: string, + data: FilterReqType, + params: RequestParams = {} + ) => this.request({ path: `/api/v1/db/meta/filters/${filterId}`, method: 'PATCH', @@ -3280,7 +3262,7 @@ export class Api< * @request POST:/api/v1/db/meta/hooks/{hookId}/filters * @response `200` `void` OK */ - create: (hookId: string, data: FilterType, params: RequestParams = {}) => + create: (hookId: string, data: FilterReqType, params: RequestParams = {}) => this.request({ path: `/api/v1/db/meta/hooks/${hookId}/filters`, method: 'POST', @@ -4705,13 +4687,7 @@ export class Api< */ test: ( tableId: string, - data: { - payload?: { - data?: any; - user?: any; - }; - hook?: HookType; - }, + data: HookTestReqType, params: RequestParams = {} ) => this.request({ diff --git a/scripts/sdk/swagger.json b/scripts/sdk/swagger.json index efe0023012..e9ee0925a1 100644 --- a/scripts/sdk/swagger.json +++ b/scripts/sdk/swagger.json @@ -138,19 +138,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "password": { - "type": "string" - } - }, - "required": [ - "email", - "password" - ] + "$ref": "#/components/schemas/SignInReq" }, "examples": { "example-1": { @@ -234,12 +222,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "email": { - "type": "string" - } - } + "$ref": "#/components/schemas/ForgotPasswordReq" } } }, @@ -311,15 +294,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "currentPassword": { - "type": "string" - }, - "newPassword": { - "type": "string" - } - } + "$ref": "#/components/schemas/PasswordChangeReq" }, "examples": { "example-1": { @@ -403,12 +378,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "new_password": { - "type": "string" - } - } + "$ref": "#/components/schemas/PasswordResetReq" } } } @@ -557,12 +527,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "key": { - "type": "string" - } - } + "$ref": "#/components/schemas/LicenseReq" } } } @@ -1087,7 +1052,9 @@ "description": "OK", "content": { "application/json": { - "schema": {} + "schema": { + "$ref": "#/components/schemas/VisibilityRuleReq" + } } } } @@ -2701,7 +2668,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/FilterReq" } } } @@ -2746,7 +2713,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/FilterReq" } } } @@ -2798,7 +2765,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Filter" + "$ref": "#/components/schemas/FilterReq" } } } @@ -2884,7 +2851,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Grid" + "$ref": "#/components/schemas/GridReq" } } } @@ -2925,7 +2892,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Form" + "$ref": "#/components/schemas/FormReq" } } } @@ -3168,7 +3135,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Gallery" + "$ref": "#/components/schemas/GalleryReq" } } } @@ -3201,7 +3168,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Gallery" + "$ref": "#/components/schemas/GalleryReq" } } } @@ -3261,7 +3228,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Kanban" + "$ref": "#/components/schemas/KanbanReq" } } } @@ -3294,7 +3261,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Kanban" + "$ref": "#/components/schemas/KanbanUpdateReq" } } } @@ -6113,19 +6080,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "payload": { - "type": "object", - "properties": { - "data": {}, - "user": {} - } - }, - "hook": { - "$ref": "#/components/schemas/Hook" - } - } + "$ref": "#/components/schemas/HookTestReq" } } } @@ -9106,12 +9061,12 @@ }, "meta": { "oneOf": [ - { - "type": "object" - }, - { - "type": "null" - }, + { + "type": "object" + }, + { + "type": "null" + }, { "type": "string" } @@ -9752,7 +9707,7 @@ "async": { "type": "boolean" }, - "payload": { }, + "payload": {}, "url": { "type": "string" }, @@ -9821,7 +9776,7 @@ ] }, "async": { - "oneOf": [ + "oneOf": [ { "type": "string" }, @@ -10108,16 +10063,14 @@ "type": "string" }, "fk_hook_id": { - - "oneOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ] - + "oneOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ] }, "type": { "type": "string" @@ -10540,27 +10493,7 @@ "content": { "application/json": { "schema": { - "description": "", - "type": "object", - "x-examples": { - "example-1": { - "email": true - } - }, - "properties": { - "email": { - "type": "string" - }, - "password": { - "type": "string" - } - } - } - }, - "application/xml": { - "schema": { - "type": "object", - "properties": {} + "$ref": "#/components/schemas/SignUpReq" } } }