Browse Source

refactor: exclude auto incremented/generated id and other system fields from request

pull/6982/head
Pranav C 12 months ago
parent
commit
2554e65061
  1. 19
      packages/nocodb/src/services/api-docs/swaggerV2/getSchemas.ts
  2. 3
      packages/nocodb/src/services/api-docs/swaggerV2/templates/schemas.ts

19
packages/nocodb/src/services/api-docs/swaggerV2/getSchemas.ts

@ -9,8 +9,7 @@ export default async function getSchemas(
{
base,
model,
columns,
views,
columns
}: {
base: Base;
model: Model;
@ -26,21 +25,5 @@ export default async function getSchemas(
columns,
});
for (const { view, columns: viewColumns } of views) {
const swaggerColumns = columns.filter(
(c) => viewColumns.find((vc) => vc.fk_column_id === c.column.id)?.show,
);
Object.assign(
swaggerSchemas,
getViewSchemas({
tableName: model.title,
viewName: view.title,
orgs: 'v1',
columns: swaggerColumns,
baseName: base.title,
}),
);
}
return swaggerSchemas;
}

3
packages/nocodb/src/services/api-docs/swaggerV2/templates/schemas.ts

@ -1,3 +1,4 @@
import { isSystemColumn } from 'nocodb-sdk';
import type { SwaggerColumn } from '../getSwaggerColumnMetas';
export const getModelSchemas = (ctx: {
@ -34,7 +35,7 @@ export const getModelSchemas = (ctx: {
...(ctx.columns?.reduce(
(colsObj, { title, virtual, column, ...fieldProps }) => ({
...colsObj,
...(virtual || column.system
...(virtual || isSystemColumn(column) || column.ai || column.meta?.ag
? {}
: {
[title]: fieldProps,

Loading…
Cancel
Save