diff --git a/packages/nocodb/src/services/api-docs/swagger/getSwaggerColumnMetas.ts b/packages/nocodb/src/services/api-docs/swagger/getSwaggerColumnMetas.ts index 660c1d45be..dd5967d56a 100644 --- a/packages/nocodb/src/services/api-docs/swagger/getSwaggerColumnMetas.ts +++ b/packages/nocodb/src/services/api-docs/swagger/getSwaggerColumnMetas.ts @@ -1,4 +1,4 @@ -import { UITypes } from 'nocodb-sdk'; +import { RelationTypes, UITypes } from 'nocodb-sdk'; import type { Base, Column, LinkToAnotherRecordColumn } from '~/models'; import SwaggerTypes from '~/db/sql-mgr/code/routers/xc-ts/SwaggerTypes'; import Noco from '~/Noco'; @@ -26,8 +26,15 @@ export default async ( ); if (colOpt) { const relTable = await colOpt.getRelatedTable(ncMeta); - field.type = undefined; - field.$ref = `#/components/schemas/${relTable.title}Request`; + if (colOpt.type === RelationTypes.BELONGS_TO) { + field.type = undefined; + field.$ref = `#/components/schemas/${relTable.title}Request`; + } else { + field.type = 'array'; + field.items = { + $ref: `#/components/schemas/${relTable.title}Request`, + }; + } } } break; diff --git a/packages/nocodb/src/services/api-docs/swagger/templates/params.ts b/packages/nocodb/src/services/api-docs/swagger/templates/params.ts index 80701928fe..65c466a3d5 100644 --- a/packages/nocodb/src/services/api-docs/swagger/templates/params.ts +++ b/packages/nocodb/src/services/api-docs/swagger/templates/params.ts @@ -197,6 +197,10 @@ export const getNestedParams = async ( ): Promise => { return await columns.reduce(async (paramsArr, { column }) => { if (column.uidt === UITypes.LinkToAnotherRecord) { + // exclude system columns(relations to junction table) + if (column.system) { + return paramsArr; + } const colOpt = await column.getColOptions(); if (colOpt.type !== RelationTypes.BELONGS_TO) { return [