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
First of all, thanks for the great library - it's nice to see how this project evolves and how responsive the authors are.
For me it is a good example on how to drive a small open-source project.
Moving on to the question - i'm creating a simple invoicing api, where we have three main resources: /invoices - is the main, self-sufficient resource:
client creates an empty invoice draft by POSTing to /invoices, and then slowly adds details (line items (/lines resource) and /discounts) one by one;
The later two: /lines and /discounts - are not meaningful without the invoice.
So, i found myself wishing to be able to create the following endpoints:
POST /invoices/<id>/lines POST /invoices/<id>/discounts
where a line items and discounts for the invoice drasft can be added.
Currently, if foud no way on how to create such endpoints for dependent resources without creating custom handler and losing all the goodness the api2go.CRUD handlers provide.
I see that the easiest solution would be to post to /lines and /discounts directly, and provide linkage with the invoice in payload,
under the "relationships" section, for example:
I might go that way, however, i'd like to ask what do you guys think about making available such endpoints for dependent resources?
Would it be hard to implement in addResource, or would it be against the spirit behind this library, or not in line of jsonapi.org specification at all (although i could not find anything like that yet in the specification or discussions)?
The text was updated successfully, but these errors were encountered:
I'm afraid i still have too little knowledge on how to properly program in Go to do a contribution yet, but i'm really looking forward to the solution :)
First of all, thanks for the great library - it's nice to see how this project evolves and how responsive the authors are.
For me it is a good example on how to drive a small open-source project.
Moving on to the question - i'm creating a simple invoicing api, where we have three main resources:
/invoices
- is the main, self-sufficient resource:client creates an empty invoice draft by POSTing to
/invoices
, and then slowly adds details (line items (/lines
resource) and/discounts
) one by one;The later two:
/lines
and/discounts
- are not meaningful without the invoice.So, i found myself wishing to be able to create the following endpoints:
POST /invoices/<id>/lines
POST /invoices/<id>/discounts
where a line items and discounts for the invoice drasft can be added.
Currently, if foud no way on how to create such endpoints for dependent resources without creating custom handler and losing all the goodness the api2go.CRUD handlers provide.
I see that the easiest solution would be to post to
/lines
and/discounts
directly, and provide linkage with the invoice in payload,under the
"relationships"
section, for example:I might go that way, however, i'd like to ask what do you guys think about making available such endpoints for dependent resources?
Would it be hard to implement in
addResource
, or would it be against the spirit behind this library, or not in line of jsonapi.org specification at all (although i could not find anything like that yet in the specification or discussions)?The text was updated successfully, but these errors were encountered: