Skip to content

Rename proto_values->values, create values.test.ts #2750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 18, 2020

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Mar 17, 2020

See #2715 for the bigger picture (and the source of values.test.ts, but it is mostly just a move of code)

@schmidt-sebastian
Copy link
Contributor Author

Note: The first commit just moves code around, the second is the diff.

@@ -385,6 +385,10 @@ function canonifyGeoPoint(geoPoint: api.LatLng): string {
return `geo(${geoPoint.latitude},${geoPoint.longitude})`;
}

function canonifyReference(referenceValue: string): string {
return DocumentKey.fromName(referenceValue).toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this break existing canonical IDs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but the feature branch includes the schema migration.

it('normalizes values for equality', () => {
// Each subarray compares equal to each other and false to every other value
const values: api.Value[][] = [
[{ integerValue: '1' }, { integerValue: 1 }],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there also a case where there's a nested value object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are referring to the Int32Proto, this seems to only be used in a target's limit specification, which allows us to encode a difference between 0 and unset. I don't see any usage for this patten in api.Value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Right.

Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

it('normalizes values for equality', () => {
// Each subarray compares equal to each other and false to every other value
const values: api.Value[][] = [
[{ integerValue: '1' }, { integerValue: 1 }],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. Right.

@wilhuff wilhuff assigned schmidt-sebastian and unassigned wilhuff Mar 18, 2020
@schmidt-sebastian schmidt-sebastian merged commit 80b2aa6 into mrschmidt/rewritefieldvalue Mar 18, 2020
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/valuesrename branch March 26, 2020 03:05
@firebase firebase locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants