Skip to content

Commit 50a7d17

Browse files
committed
chore: code cleanup
1 parent 55088ac commit 50a7d17

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

packages/googleapis_firestore/lib/src/field_value.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,6 @@ void _validateUserInput(
426426

427427
case Map<Object?, Object?>():
428428
for (final entry in value.entries) {
429-
// FieldPath keys (from UpdateMap) are already validated field paths
430-
// and must be used as-is to preserve multi-segment paths.
431-
// String keys are literal Firestore map keys and must NOT be routed
432-
// through _StringFieldMask, which rejects valid key characters such
433-
// as '/'. Construct a single-segment FieldPath directly instead.
434429
final keyPath = switch (entry.key) {
435430
final FieldPath fp => fp,
436431
final String s => FieldPath([s]),

packages/googleapis_firestore/test/firestore_test.dart

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,11 @@ void main() {
168168
expect(batch, isA<WriteBatch>());
169169
});
170170

171-
// Regression test for https://github.com/invertase/dart_firebase_admin/issues/83
172-
//
173-
// Firestore allows '/' characters inside map *keys* (e.g. document
174-
// reference paths stored as map keys). The SDK was incorrectly routing
175-
// map keys through field-path validation, which rejects '/', causing an
176-
// ArgumentError before any network call was made.
177-
group('map keys with "/" characters (issue #83)', () {
178-
late Firestore firestore;
179-
180-
setUp(() {
181-
firestore = Firestore(settings: const Settings(projectId: 'test'));
182-
});
183-
184-
test('set() should not throw for a map key containing "/"', () {
171+
group('set() with map keys containing "/"', () {
172+
test('accepts a top-level map value with "/" in key', () {
173+
final firestore = Firestore(
174+
settings: const Settings(projectId: 'test'),
175+
);
185176
final batch = firestore.batch();
186177
final docRef = firestore.doc('activities/new-activity');
187178

@@ -194,7 +185,10 @@ void main() {
194185
);
195186
});
196187

197-
test('set() should not throw for nested maps with "/" in keys', () {
188+
test('accepts nested maps with "/" in keys', () {
189+
final firestore = Firestore(
190+
settings: const Settings(projectId: 'test'),
191+
);
198192
final batch = firestore.batch();
199193
final docRef = firestore.doc('col/doc');
200194

0 commit comments

Comments
 (0)