You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this mainly about discoverability? I.e., you couldn't figure out how to write code to create - or is it also about readability - i.e., Resource.getList.push doesn't make sense.
I am having a slightly different but related issue, which I can open a new issue for if necessary. I cannot determine how to extend getList.push in order to specify a new body type for the POST request. The following does not work:
TypeError: Cannot set property push of [object Object] which has only a getter
I may have missed it but I don't see anywhere in the docs or migration guide how we're supposed to extend this new getList.push method of creating entities. Do I have to extend create instead and ignore the deprecation warnings?
RestEndpoint.push inherits the body type from its parent. Since 'GET' RestEndpoints don't use the body, you can simply set the getList body and it will only be used with unshift and push.
This means you can achieve what you desire by using the override version of Resource.extend
In an effort to help others avoid this confusion - was this the upgrade guide you were looking at? If not, could you link to what you were looking at?
PS) To help others more easily find issues, I would prefer new issue opened and simply include a reference to related issues when mentioning. It can be difficult to navigate in a block of comments for things, but including links ensures people can still find slightly related things easily.
@ntucker thanks so much! Yes, the upgrade guide you linked is what I was looking at. I think a note under the Resource.extend() section for this specific use case would be very helpful.
Activity
ntucker commentedon Oct 9, 2023
Thanks for the report!
Is this mainly about discoverability? I.e., you couldn't figure out how to write code to create - or is it also about readability - i.e., Resource.getList.push doesn't make sense.
th3fallen commentedon Oct 9, 2023
the latter mostly
ntucker commentedon Oct 9, 2023
Hmm, curious about the use case: Do you want to create a new item and not add it to a list? Do you have a list endpoint at all?
ntucker commentedon Oct 9, 2023
For context, the API was modeled after Backbone collections
ntucker commentedon Oct 19, 2023
Hmm, push is the standard terminology I've found:
Do you have a suggestion for a better way to distinguish adding to end, beginning, or inserted in sorted order?
jacobcossman commentedon Dec 27, 2023
I am having a slightly different but related issue, which I can open a new issue for if necessary. I cannot determine how to extend
getList.pushin order to specify a newbodytype for thePOSTrequest. The following does not work:I get the following error:
I may have missed it but I don't see anywhere in the docs or migration guide how we're supposed to extend this new
getList.pushmethod of creating entities. Do I have to extendcreateinstead and ignore the deprecation warnings?ntucker commentedon Dec 28, 2023
@jacobcossman Thanks for the report.
A few things of note:
This means you can achieve what you desire by using the override version of Resource.extend
In an effort to help others avoid this confusion - was this the upgrade guide you were looking at? If not, could you link to what you were looking at?
PS) To help others more easily find issues, I would prefer new issue opened and simply include a reference to related issues when mentioning. It can be difficult to navigate in a block of comments for things, but including links ensures people can still find slightly related things easily.
jacobcossman commentedon Dec 28, 2023
@ntucker thanks so much! Yes, the upgrade guide you linked is what I was looking at. I think a note under the Resource.extend() section for this specific use case would be very helpful.
Also noted about opening new issues 👍