celestiaorg / celestia-node

Celestia Data Availability Nodes
Apache License 2.0
931 stars 926 forks source link

[Feature Request]: Version the JSON RPC API #3950

Open cmwaters opened 3 days ago

cmwaters commented 3 days ago

Implementation ideas

This issue proposes adding a versioning system to the JSON RPC API that would allow us to slowly deprecate older API methods (adding is trivial) so as to give users apt time to migrate to the newer API methods. Ideally this introduction itself is done in a backwards compatible change (i.e. no version specified is interpreted as v1).

How versioning is done (in the url vs in the method vs in the params) is left to be decided.

Wondertan commented 3 days ago

The API reports version at node.Info endpoint: https://github.com/celestiaorg/celestia-node/blob/main/nodebuilder%2Fnode%2Fadmin.go#L29-L34

cmwaters commented 3 days ago

So how would having a v2 while supporting a v1 work?

I think it's common for the client to provide the version that they are currently on and the server tries to match it - that way we can provide some degree of backwards compatibility