Closed zhangt58 closed 1 year ago
I suspect there is some odd interaction between FastAPI's serialization of numpy arrays, and aioca (via epicscorelibs) usage of a subclass of numpy arrays. It's suspicious that the attributes that are set on the array are the only keys in the serialized dict: https://github.com/mdavidsaver/epicscorelibs/blob/master/src/python/epicscorelibs/ca/dbr.py#L801-L804
Please could you post the FastAPI issue and the code that generated the error?
Thanks for pointing out the code lines that eventually helped me understand where those dict keys come from. And your guess was right, the default FastAPI jsonizer (jsonable_encoder) does not handle ca_array data as expected, as such, I constructed the JSON response with Response class.
Hi, it seems the waveform data does not return as expected in a REST API. For a regular PV with scalar value returns, it returns the single value as requested, but when requesting a waveform PV value, the same API returns a dict like:
I can get the expected waveform of
ca_array
in ipython withawait aioca.caget
. The version of aioca I'm using is 1.3.I'm seeking some answers on the FastAPI side (which I'm using to build the REST API), while hoping that maybe I missed something on the aioca side. Appreciate to any help. Tong