Skip to content

Commit d2991c6

Browse files
skos-ninjaschmidt-sebastian
authored andcommitted
fix: add quotes to field name to avoid ambiguity (#860)
1 parent 8ab0358 commit d2991c6

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

handwritten/firestore/dev/src/serializer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export function validateUserInput(
308308
level = level || 0;
309309
inArray = inArray || false;
310310

311-
const fieldPathMessage = path ? ` (found in field ${path})` : '';
311+
const fieldPathMessage = path ? ` (found in field "${path}")` : '';
312312

313313
if (Array.isArray(value)) {
314314
for (let i = 0; i < value.length; ++i) {

handwritten/firestore/dev/src/validate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function customObjectMessage(
6767
value: unknown,
6868
path?: FieldPath
6969
): string {
70-
const fieldPathMessage = path ? ` (found in field ${path})` : '';
70+
const fieldPathMessage = path ? ` (found in field "${path}")` : '';
7171

7272
if (isObject(value)) {
7373
// We use the base class name as the type name as the sentinel classes

handwritten/firestore/dev/test/document.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,22 @@ describe('serialize document', () => {
140140
expect(() => {
141141
firestore.doc('collectionId/documentId').set({foo: undefined});
142142
}).to.throw(
143-
'Value for argument "data" is not a valid Firestore document. Cannot use "undefined" as a Firestore value (found in field foo).'
143+
'Value for argument "data" is not a valid Firestore document. Cannot use "undefined" as a Firestore value (found in field "foo").'
144144
);
145145

146146
expect(() => {
147147
firestore.doc('collectionId/documentId').set({
148148
foo: FieldPath.documentId(),
149149
});
150150
}).to.throw(
151-
'Value for argument "data" is not a valid Firestore document. Cannot use object of type "FieldPath" as a Firestore value (found in field foo).'
151+
'Value for argument "data" is not a valid Firestore document. Cannot use object of type "FieldPath" as a Firestore value (found in field "foo").'
152152
);
153153

154154
expect(() => {
155155
class Foo {}
156156
firestore.doc('collectionId/documentId').set({foo: new Foo()});
157157
}).to.throw(
158-
'Value for argument "data" is not a valid Firestore document. Couldn\'t serialize object of type "Foo" (found in field foo). Firestore doesn\'t support JavaScript objects with custom prototypes (i.e. objects that were created via the "new" operator).'
158+
'Value for argument "data" is not a valid Firestore document. Couldn\'t serialize object of type "Foo" (found in field "foo"). Firestore doesn\'t support JavaScript objects with custom prototypes (i.e. objects that were created via the "new" operator).'
159159
);
160160

161161
expect(() => {
@@ -1238,7 +1238,7 @@ describe('set document', () => {
12381238
expect(() => {
12391239
firestore.doc('collectionId/documentId').set({foo: FieldValue.delete()});
12401240
}).to.throw(
1241-
'Value for argument "data" is not a valid Firestore document. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field foo).'
1241+
'Value for argument "data" is not a valid Firestore document. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field "foo").'
12421242
);
12431243
});
12441244

@@ -1587,15 +1587,15 @@ describe('update document', () => {
15871587
a: {b: FieldValue.delete()},
15881588
});
15891589
}).to.throw(
1590-
'Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Value for argument "dataOrField" is not a valid Firestore value. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field a.b).'
1590+
'Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Value for argument "dataOrField" is not a valid Firestore value. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field "a.b").'
15911591
);
15921592

15931593
expect(() => {
15941594
firestore.doc('collectionId/documentId').update('a', {
15951595
b: FieldValue.delete(),
15961596
});
15971597
}).to.throw(
1598-
'Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Element at index 1 is not a valid Firestore value. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field a.b).'
1598+
'Update() requires either a single JavaScript object or an alternating list of field/value pairs that can be followed by an optional precondition. Element at index 1 is not a valid Firestore value. FieldValue.delete() must appear at the top-level and can only be used in update() or set() with {merge:true} (found in field "a.b").'
15991599
);
16001600

16011601
expect(() => {

0 commit comments

Comments
 (0)