Skip to content

Commit 65b9a9e

Browse files
committed
remove validation
1 parent f0d817a commit 65b9a9e

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

packages/compass-collection/src/transform-schema-to-field-info.spec.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,66 +1111,6 @@ describe('processSchema', function () {
11111111
* These are unlikely to occur with valid `Schema` inputs to `processSchema`.
11121112
*/
11131113
describe('validateFieldPath error conditions', function () {
1114-
it('throws error for incomplete brackets in middle of field part', function () {
1115-
const schema: Schema = {
1116-
fields: [
1117-
{
1118-
name: 'field[invalid', // Incomplete bracket
1119-
path: ['field[invalid'],
1120-
count: 1,
1121-
type: ['String'],
1122-
probability: 1.0,
1123-
hasDuplicates: false,
1124-
types: [
1125-
{
1126-
name: 'String',
1127-
bsonType: 'String',
1128-
path: ['field[invalid'],
1129-
count: 1,
1130-
probability: 1.0,
1131-
values: ['test'],
1132-
},
1133-
],
1134-
},
1135-
],
1136-
count: 1,
1137-
};
1138-
1139-
expect(() => processSchema(schema)).to.throw(
1140-
"invalid fieldPath 'field[invalid': '[]' can only appear at the end of field parts"
1141-
);
1142-
});
1143-
1144-
it('throws error for brackets in middle of field part', function () {
1145-
const schema: Schema = {
1146-
fields: [
1147-
{
1148-
name: 'field[]invalid', // Brackets in middle
1149-
path: ['field[]invalid'],
1150-
count: 1,
1151-
type: ['String'],
1152-
probability: 1.0,
1153-
hasDuplicates: false,
1154-
types: [
1155-
{
1156-
name: 'String',
1157-
bsonType: 'String',
1158-
path: ['field[]invalid'],
1159-
count: 1,
1160-
probability: 1.0,
1161-
values: ['test'],
1162-
},
1163-
],
1164-
},
1165-
],
1166-
count: 1,
1167-
};
1168-
1169-
expect(() => processSchema(schema)).to.throw(
1170-
"invalid fieldPath 'field[]invalid': '[]' can only appear at the end of field parts"
1171-
);
1172-
});
1173-
11741114
it('throws error for empty field parts', function () {
11751115
const schema: Schema = {
11761116
fields: [

packages/compass-collection/src/transform-schema-to-field-info.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,18 +269,5 @@ function validateFieldPath(fieldPath: string) {
269269
`invalid fieldPath '${fieldPath}': field parts must have characters other than '[]'`
270270
);
271271
}
272-
273-
// Check that [] only appears as complete pairs and only at the end of the part
274-
// Remove all trailing [] pairs and check if any [] remains in the middle
275-
// Regex breakdown: (\[\])+$
276-
// (\[\]) - matches exactly the characters "[]" (brackets are escaped)
277-
// + - one or more times
278-
// $ - at the end of the string
279-
const remaining = part.replace(/(\[\])+$/, '');
280-
if (remaining.includes('[') || remaining.includes(']')) {
281-
throw new ProcessSchemaValidationError(
282-
`invalid fieldPath '${fieldPath}': '[]' can only appear at the end of field parts`
283-
);
284-
}
285272
}
286273
}

0 commit comments

Comments
 (0)