You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It has compatible libraries for java (android), javascript and python.
Is it possible for you to create functionality that happens automatically for each endpoint - that it accepts data in flatbuffers and gives response in flatbuffers if the request has Accept: application/x-flatbuffers in it.
e.g. curl -D- -H "Accept: application/x-flatbuffers" http://localhost:7002
if the header is not present, then the endpoint works with default json
The text was updated successfully, but these errors were encountered:
I've been thinking about how we could add new serialization formats into this lib, specifically about Avro, protobuf & msgpack. Now there's another format that you propose, so I guess this might be implemented in the future. There is actually not much work to do: create custom Response class & Route class. Reference: fastapi/fastapi#521
But it would require additional deps to be installed. I guess we can just copy-paste the somewhat standard practice of making optional deps and making them required only for specific features. For example, pip install fastapi_contrib[msgpack] or pip install fastapi_contrib[flatbuffers]. Thus we can also make ujson optional as I wanted since the start :)
I don't think I have time to do something like this in next couple of weeks, but you are very welcome to send PR.
My understanding is that protobuf and flatbuffer should be pretty similar to implement (I haven't looked into it deeply though). The biggest challenge seems to me to be generating the specs from the pydantic models -- that may be worth a pydantic feature request (if such a request hasn't already been addressed anyway).
Flatbuffers is the high performance serialization library from Google - https://google.github.io/flatbuffers/flatbuffers_guide_use_python.html
It has compatible libraries for java (android), javascript and python.
Is it possible for you to create functionality that happens automatically for each endpoint - that it accepts data in flatbuffers and gives response in flatbuffers if the request has
Accept: application/x-flatbuffers
in it.e.g.
curl -D- -H "Accept: application/x-flatbuffers" http://localhost:7002
if the header is not present, then the endpoint works with default json
The text was updated successfully, but these errors were encountered: