django-api-domains icon indicating copy to clipboard operation
django-api-domains copied to clipboard

[QUESTION] Restrictions on data types that services may return.

Open voyc-jean opened this issue 6 years ago • 2 comments

I noticed that within the styleguide and examples, service functions / methods always return a Dict. Is returning more complext data, such as model instances, permissible?

PS, the one exception is this example, but I think this may be a mistake as a dict is ultimately returned.

voyc-jean avatar Apr 07 '20 23:04 voyc-jean

Good question:

For APIs:

All data returned from APIs must be serializable.

For Services there is no restriction :)

phalt avatar Apr 08 '20 07:04 phalt

Great, thanks @phalt. I've created a PR [#21] which includes a few fixes, including the issue with the example which I originally mentioned.

voyc-jean avatar Apr 08 '20 09:04 voyc-jean