skilld-labs / go-odoo

Golang wrapper for Odoo API
Apache License 2.0
86 stars 62 forks source link

Return json from Odoo API call #34

Closed pocockn closed 1 year ago

pocockn commented 1 year ago

When data enters via ingress we transform it into []map[string]interface.

If we return a JSON encoded byte slice from the Odoo API we can easily use our current tooling to transform those bytes into []map[string]interface{} and validate, transform and render the document.

Returning as a byte slice allows us to easily send the data over the wire.

This is an easier process than returning one of the generated structs, transforming it to a format we support and then transforming to a []map[string]interface

ahuret commented 1 year ago

Hey @pocockn ! Not sure to understand what you're trying to do. If you want to use []map[string]interface{} instead of strictly typed models you can use the low level methods from odoo.go (example: https://github.com/skilld-labs/go-odoo/blob/master/odoo.go#L212) and inject in the elem parameter a []map[string]interface{}, it should work.

Tell me if you have any question :-)

Antoine