driplineorg / dripline-python

python implementation of project8/dripline
Apache License 2.0
3 stars 6 forks source link

Return types in Endpoint.on_get_request() should be expanded #163

Open nsoblath opened 5 months ago

nsoblath commented 5 months ago

Currently only values are allowed as return types. But we could expand that to cover anything that can be converted into a param type.

https://github.com/driplineorg/dripline-python/blob/c0e1e1cfb333969347a59480815fd337dcf0c695/dripline/core/endpoint.py#L51

Let's allow an_attribute to be anything convertible to param.

And perhaps if it's not convertible to param we try to convert it to a string representation. That should cover most cases.

Effectively:

try:
    converToParam(attribute)
catch [maybe RuntimeError?  or did we create a custom translator for scarab::error?]
    convertUsingRepr(attribute)