Open johanstokking opened 5 years ago
Please discuss relevance for Next Up
I think we should look into resolving this in the near future.
We dont need to change the current api of the stack in order to implement this. We can generate api methods for the js sdk using the swagger schema that is produced by grpc-gateway.
Also, references https://github.com/TheThingsNetwork/lorawan-stack/issues/1982. no api changes required as well
update on this. I have a working utility that can generate API functions from the swagger schema using babel. However, I would like to check if we can use grpc directly.
I have tried that in the past. The best way (at the time) was https://github.com/improbable-eng/grpc-web
See #2298 for an open issue with Swagger also
FYI https://github.com/grpc/grpc-web is supported by https://github.com/TheThingsIndustries/docker-protobuf
Not sure what's the difference from improbable-eng
one and if it's related at all
Moving to Next up
since this doesnt cause any problems with the current setup and there are issues with higher priority to work on.
Summary: Currently,
api
methods for the http connector in thejs-sdk
are generated at runtime from ajson
schema that contains allapi
defintions.What is already there? What do you see now? All
api
methods are generated at runtime when the main instance gets instantiated on the client. Theapi-defintions.json
gets parsed and for each entry a method is created in theapi
module.What is missing? What do you want to see? A set of generated
es6
methods (during build) that will delegate allapi
calls toaxios
and can be published within thesdk
, without the need to include redundantjson
files and generate the methods at runtime.This shouldnt be too hard, since all methods have the same structure, only the arguments differ.
Worth noting, that the current implementation should stay until the draft
sdk
is finished, as well as the backend api, and can be tested.Original issue: https://github.com/TheThingsIndustries/lorawan-stack/issues/1137 by @bafonins