earthrise-media / plastics

Other
14 stars 7 forks source link

Post site API does not appear to follow swagger spec #31

Closed tmcw closed 3 years ago

tmcw commented 3 years ago

https://github.com/earthrise-media/plastics/blob/b70daa6a93201696e6d0c9d514a8c17f2fc4fadf/api/handler/site.go#L93-L101

This doesn't seem to match with

The service will echo out sites that have been added to the database and will also include an ID as a property. This ID can be used to identify the site for future requests

Instead of status 200, this returns 201, and instead of returning the created site, this returns an empty response.

tingold commented 3 years ago

I did this intentionally but didn't update the spec yet....wasn't sure if returning the site IDs would be useful or not. Let me know what you prefer and I can make it happen...

tmcw commented 3 years ago

Ideally it would return the new spot. Right now it's pretty tricky because the IDs I'm getting back from the database seem to be in arbitrary order, and I'm posting sites and then trying to figure out what's the new id of the site that I posted, so for every insert, I need do do a query and a bunch of data munging.