Skip to content
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

Namespace query #3459

Closed
wants to merge 8 commits into from
Closed

Namespace query #3459

wants to merge 8 commits into from

Conversation

thaume
Copy link

@thaume thaume commented Jun 29, 2015

@igorT a few questions :

1/ Tests directory
Should I move the "integration/adapter/queries - Queries” test module to "integration/store/query” (alongside "integration/store/queryRecord”)

2/ Function param (modelName, query) => (modelName, options)
Does that make sense ? Writing options.query seems better than query.query, what do you think ?

3/ In "integration/adapter/rest_adapter" Rename findQuery to query in tests ?

It is still a WIP, I need to read myself again to catch any typo/non-up-to-date comments

@wecc
Copy link
Contributor

wecc commented Jun 29, 2015

1/ Tests directory
Should I move the "integration/adapter/queries - Queries” test module to "integration/store/query” (alongside "integration/store/queryRecord”)

This makes sense to me.

2/ Function param (modelName, query) => (modelName, options)
Does that make sense ? Writing options.query seems better than query.query, what do you think ?

I believe options is correct here as it's are not limited to contain query IIRC? ping @bmac

3/ In "integration/adapter/rest_adapter" Rename findQuery to query in tests ?

Go for it!

@bmac
Copy link
Member

bmac commented Jun 30, 2015

options sounds good to me.

@thaume
Copy link
Author

thaume commented Jul 2, 2015

Alright I think this PR is ready for a check !

switch (requestType) {
case 'findRecord':
return this.urlForFindRecord(id, modelName, snapshot);
case 'findAll':
return this.urlForFindAll(modelName);
case 'query':
return this.urlForQuery(query, modelName);
return this.urlForQuery(options, modelName);
Copy link
Member

Choose a reason for hiding this comment

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

This and line 52 seems like it could be a breaking change. Any thoughts on how to make the transition easier @igorT?

@thaume
Copy link
Author

thaume commented Jul 5, 2015

@bmac just pushed the changes we talked about, are we waiting for @igorT about the issue you mentioned in packages/ember-data/lib/adapters/build-url-mixin.js above ?

We could do a simple deprecation stuff :
1/ deprecation warning
2/ then we create a query hash inside the options hash. Pseudo code : options.query = options.query || options
Once the deprecation is transformed into an assertion, we can remove the "transition" line (point 2).

What do you think ?

@param {String or subclass of DS.Model} type
@param {any} query an opaque query to be used by the adapter
@param {String} modelName
@param {Hash} options, query an opaque query of the form {query: { any }} to be used by the adapter
Copy link
Member

Choose a reason for hiding this comment

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

The API docs prefer the term Object instead of Hash for the type annotations. Same for line 1045 above.

@thaume
Copy link
Author

thaume commented Jul 7, 2015

Btw can I use the ES6 default parameter feature (options={}) instead of options = options || {}; ?

@thaume
Copy link
Author

thaume commented Jul 8, 2015

@bmac should be good to go !

@bmac
Copy link
Member

bmac commented Jul 8, 2015

Awesome @thaume. @igorT can you review?

@bmac
Copy link
Member

bmac commented Jul 17, 2015

ping @igorT r?

@thaume
Copy link
Author

thaume commented Jul 17, 2015

@bmac I think this PR has been descoped

@bmac
Copy link
Member

bmac commented Jul 24, 2015

ping @igorT. This pr still has an open question on backwards compatibility.

@bmac
Copy link
Member

bmac commented Oct 12, 2015

Hi @thaume. Thanks so much for this work. Unfortunately, we weren't able to get this pr merged before the Ember Data 2.0 release. I'm going to close this pr for now because I believe we missed the opportunity to make this change without breaking semver.

Please feel free to reopen if you disagree.

@bmac bmac closed this Oct 12, 2015
@thaume
Copy link
Author

thaume commented Oct 13, 2015

Hi @bmac. I knew it already ;) Thanks for your work on ember data !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants