Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: corrections

Pranav C75df91fde8c0
diff --git a/packages/nocodb/src/services/api-docs/swagger/getPaths.ts b/packages/nocodb/src/services/api-docs/swagger/getPaths.ts
index 95d1c6241b..2efc898306 100644
--- a/packages/nocodb/src/services/api-docs/swagger/getPaths.ts
+++ b/packages/nocodb/src/services/api-docs/swagger/getPaths.ts
@@ -5,10 +5,6 @@ import type { SwaggerView } from './getSwaggerJSON';
import type { NcContext } from '~/interface/config';
import Noco from '~/Noco';
-// Helper function to sanitize names for use in schema names
-function sanitizeSchemaName(name: string): string {
- return name.replace(/[^a-zA-Z0-9_]/g, '_');
-}
export default async function getPaths(
context: NcContext,
@@ -44,7 +40,7 @@ export default async function getPaths(
swaggerPaths,
await getViewPaths(context, {
tableName,
- viewName: sanitizeSchemaName(view.title),
+ viewName: view.title,
type: model.type,
orgs: 'v1',
columns: swaggerColumns,
diff --git a/packages/nocodb/src/services/api-docs/swagger/getSchemas.ts b/packages/nocodb/src/services/api-docs/swagger/getSchemas.ts
index 1f000808b2..58079adfda 100644
--- a/packages/nocodb/src/services/api-docs/swagger/getSchemas.ts
+++ b/packages/nocodb/src/services/api-docs/swagger/getSchemas.ts
@@ -5,10 +5,6 @@ import type { SwaggerColumn } from './getSwaggerColumnMetas';
import type { SwaggerView } from './getSwaggerJSON';
import Noco from '~/Noco';
-// Helper function to sanitize names for use in schema names
-function sanitizeSchemaName(name: string): string {
- return name.replace(/[^a-zA-Z0-9_]/g, '_');
-}
export default async function getSchemas(
context,
@@ -42,7 +38,7 @@ export default async function getSchemas(
swaggerSchemas,
getViewSchemas({
tableName,
- viewName: sanitizeSchemaName(view.title),
+ viewName: view.title,
orgs: 'v1',
columns: swaggerColumns,
baseName: base.title,
diff --git a/packages/nocodb/src/services/api-docs/swagger/getSwaggerJSON.ts b/packages/nocodb/src/services/api-docs/swagger/getSwaggerJSON.ts
index f1911e2d62..13761b38e7 100644
--- a/packages/nocodb/src/services/api-docs/swagger/getSwaggerJSON.ts
+++ b/packages/nocodb/src/services/api-docs/swagger/getSwaggerJSON.ts
@@ -34,10 +34,6 @@ export default async function getSwaggerJSON(
const sources = await base.getSources(false, ncMeta);
const sourcesMap = new Map(sources.map((source) => [source.id, source]));
- // Helper function to sanitize names for use in schema names
- function sanitizeSchemaName(name: string): string {
- return name.replace(/[^a-zA-Z0-9_]/g, '_');
- }
// Pre-construct table names for all models to avoid repeated construction and handle duplicates
const tableNamesMap = new Map<string, string>();
@@ -47,8 +43,8 @@ export default async function getSwaggerJSON(
const source = sourcesMap.get(model.source_id);
const sourcePrefix = source?.isMeta()
? ''
- : `${sanitizeSchemaName(source?.alias || 'Source')}_`;
- const tableName = `${sourcePrefix}${sanitizeSchemaName(model.title)}`;
+ : `${source?.alias || 'Source'}_`;
+ const tableName = `${sourcePrefix}${model.title}`;
// Handle duplicate table names by adding a number suffix
let finalTableName = tableName;
diff --git a/packages/nocodb/src/services/api-docs/swaggerV2/getSwaggerJSONV2.ts b/packages/nocodb/src/services/api-docs/swaggerV2/getSwaggerJSONV2.ts
index 059cab7a7f..e86051dc2a 100644
--- a/packages/nocodb/src/services/api-docs/swaggerV2/getSwaggerJSONV2.ts
+++ b/packages/nocodb/src/services/api-docs/swaggerV2/getSwaggerJSONV2.ts
@@ -34,10 +34,6 @@ export default async function getSwaggerJSONV2(
const sources = await base.getSources(false, ncMeta);
const sourcesMap = new Map(sources.map((source) => [source.id, source]));
- // Helper function to sanitize names for use in schema names
- function sanitizeSchemaName(name: string): string {
- return name.replace(/[^a-zA-Z0-9_]/g, '_');
- }
// Pre-construct table names for all models to avoid repeated construction and handle duplicates
const tableNamesMap = new Map<string, string>();
@@ -47,8 +43,8 @@ export default async function getSwaggerJSONV2(
const source = sourcesMap.get(model.source_id);
const sourcePrefix = source?.isMeta()
? ''
- : `${sanitizeSchemaName(source?.alias || 'Source')}_`;
- const tableName = `${sourcePrefix}${sanitizeSchemaName(model.title)}`;
+ : `${source?.alias || 'Source'}_`;
+ const tableName = `${sourcePrefix}${model.title}`;
// Handle duplicate table names by adding a number suffix
let finalTableName = tableName;
diff --git a/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerColumnMetasV3.ts b/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerColumnMetasV3.ts
index f8aff71503..f7a78a34cb 100644
--- a/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerColumnMetasV3.ts
+++ b/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerColumnMetasV3.ts
@@ -4,7 +4,7 @@ import type { Column, LinkToAnotherRecordColumn } from '~/models';
import type { NcContext } from '~/interface/config';
import type LookupColumn from '~/models/LookupColumn';
import type { DriverClient } from '~/utils/nc-config';
-import { Base, Base } from '~/models';
+import { Base } from '~/models';
import SwaggerTypes from '~/db/sql-mgr/code/routers/xc-ts/SwaggerTypes';
import Noco from '~/Noco';
diff --git a/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerJSONV3.ts b/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerJSONV3.ts
index 990cb724f2..4d83bbf225 100644
--- a/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerJSONV3.ts
+++ b/packages/nocodb/src/services/api-docs/swaggerV3/getSwaggerJSONV3.ts
@@ -34,10 +34,6 @@ export default async function getSwaggerJSONV3(
const sources = await base.getSources(false, ncMeta);
const sourcesMap = new Map(sources.map((source) => [source.id, source]));
- // Helper function to sanitize names for use in schema names
- function sanitizeSchemaName(name: string): string {
- return name.replace(/[^a-zA-Z0-9_]/g, '_');
- }
// Pre-construct table names for all models to avoid repeated construction and handle duplicates
const tableNamesMap = new Map<string, string>();
@@ -47,8 +43,8 @@ export default async function getSwaggerJSONV3(
const source = sourcesMap.get(model.source_id);
const sourcePrefix = source?.isMeta()
? ''
- : `${sanitizeSchemaName(source?.alias || 'Source')}_`;
- const tableName = `${sourcePrefix}${sanitizeSchemaName(model.title)}`;
+ : `${source?.alias || 'Source'}_`;
+ const tableName = `${sourcePrefix}${model.title}`;
// Handle duplicate table names by adding a number suffix
let finalTableName = tableName;