-
Notifications
You must be signed in to change notification settings - Fork 971
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
Support v1beta2 indexes API #1014
Conversation
@coveralls try again? |
Whoops, forgot to assign. @mbleigh feel free to pass off to someone else. |
|
||
// Try to detect use of the old API, warn the users. | ||
if (spec.indexes[0].collectionId) { | ||
utils.logBullet( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you print this message, you still want to continue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is fine for now. Maybe in the future this will be breaking.
src/test/firestore/indexes.spec.ts
Outdated
{ fieldPath: "bar", arrayConfig: "CONTAINS" }, | ||
], | ||
state: API.State.READY, | ||
} as API.Index; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is definitely a hole in my TS knowledge - is this equivalent? (with no as API.Index
)
const apiIndex: API.Index = {...};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I am not sure what's going on here ... if I do what you suggested it wants me to define all undefined fields as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wait I figured it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems reasonable to me as code, but I am not super confident in functional testing it. Is there something I can to do exercise this locally and test it out?
@@ -86,7 +87,7 @@ describe("IndexValidation", () => { | |||
}, | |||
], | |||
}); | |||
}).to.throw(); | |||
}).to.throw(FirebaseError, /Must contain exactly one of "order,arrayConfig"/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
,
with no space after? Should that have a space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specifically, in the "Must contain exactly" error message
@bkendall yeah you can do a few things: Setup
Tests
|
@bkendall should I be waiting for you to do some integration testing here? |
Looks like 'upgrade' for old-to-new may have a bug, but the functional testing I did looks good :) |
Enables #889
The new indexes API better supports:
Example of pretty-printing index config with some field exemptions:
![image](https://user-images.githubusercontent.com/8466666/49675127-35eb0d00-fa29-11e8-8f5d-012469752bef.png)