-
Notifications
You must be signed in to change notification settings - Fork 22
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
Arrays not working right #22
Comments
@mshappe Sorry for the delayed response. I had a rushed deadline last week. I agree that this is confusing. The issue is that the The following works for me: t = new UriTemplate('{?list[]*}')
t.fillFromObject({ "list[]": ["magenta", "cyan", "yellow"] })
// => "?list[]=magenta&list[]=cyan&list[]=yellow" It would be nice to have first-class support for this kind of array syntax, but it is not supported by the URI template spec. For now, is there something that could be changed to make the documentation clearer? |
The problem does not appear to be in the underlying |
@mshappe oh, I misunderstood. I'll have to do some testing to see if I can reproduce. Can you give me some more information that might help me reproduce this? What versions of ember.js and ember-data are you using? Thanks |
Just moved up to Ember 2.3.x (yes, I know, way behind, but we were Ember 1.13.15 before that, so this is a huge advance 😄). Ahead of that, I advanced all the other dependencies I could, so I actually moved this up to 0.2.0 before that jump. At first blush everything looked fine, but then I went to a page that relied on a query string to the server to produce filtered results and realized I was instead getting fully unfiltered results. I looked Realizing that it USED to work, I just backed off to 0.1.5, and that's working fine for now. |
Yeah, we're also at 1.13.14 at work. Upgrading is on the TODO list :/ Thanks for all this information. The story of your issue is very helpful and I'm sorry I broke your application by releasing 0.2.0. Here's my guess as to what happened in your case. With 0.1.5, your query 0.2.0 includes this fix, which removes existing behavior where ember-data would add query params independently of ember-data-url-templates. So, when you upgraded to 0.2.0, the jquery parsing of your query was removed. To fix your issue in 0.2.0, you could try any of the following:
I would love to hear if any of these work for you. |
@amiel Thank you for this--this explanation makes sense. I will not have a chance to play with this for a day or two (I'm currently elbows-deep in UI changes instead 😄) but will try to get to it soon and let you know! |
And yes, I think the docco could be made clearer -- once I verify that your suggestions make it all behave, I may suggest edits to the Wiki. Again, thank you for your prompt and thorough response! |
no rush; thanks for looking in to it
Please do, I would appreciate suggested edits very much |
FYI: I've got a little more time to work on ember-data-url-templates now and I'm planning to at least try out a feature that supports these nested structures. |
Just my $0.02 but I don't think I would have expected |
Querying with something like:
{ foo: ["1", "2"] }
I cannot seem to construct any template that will actually give me
?foo[]=1&foo[]=2
Based on the documentation the following SHOULD work:
queryUrlTemplate: '{+host}/api/v2/whatever{?foo[]*}'
But in fact
{?foo[]*}
is entirely ignored.The text was updated successfully, but these errors were encountered: