reyesoft / ngx-jsonapi

JSON API client library for Angular 5+ 👌 :: Production Ready 🚀
https://ngx-jsonapi.reyesoft.com/
MIT License
101 stars 52 forks source link

It is impossible to create a new resource when providing a client-generated ID #281

Open unterwegsmitkeks opened 4 years ago

unterwegsmitkeks commented 4 years ago

The request body with an ID should look like this:

{ "data": { "id": "my-own-id", "type": "atype", "attributes": { "foo": "bar" } } }

kirkasius commented 4 years ago

I have experienced the same issue.

The problem is that ngx-jsonapi is adding the id also to the url if it is present in the data. The url should be http://SERVER/api/atype instead of http://SERVER/api/atype/my-own-id.

pablorsk commented 4 years ago

The bug is only the URL modification? Or you detect another bug?

unterwegsmitkeks commented 4 years ago

The bug is only the URL modification? Or you detect another bug?

My bad - I had actually detected the URL issue, too, but forgot to mention it in the bug description. It looks like that is the actual bug. Otherwise, the function is behaving as expected.