-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor API calls to be more future-proof #245
Comments
We could even implement this API entirely in C++ without breaking clients that use positional arguments. Here's how I'd do it:
By straightforwardly defining parameter structs, we can replace The win here is that, by maintaining support for positional arguments, the transition from brittle argument-based methods to extensible struct-based methods can occur without breaking client code. |
This should wait until #422 . |
This issue was moved to bitshares/bitshares-core#64 |
Implementation of #236 has revealed a general issue when extending API calls. When adding parameters to an API call, it has been noted that we should have a cycle of introducing a new call, deprecating the old call, waiting for web UI code to be updated, and then removing the old call.
The deprecation cycle is necessary because adding parameters to an API call breaks every API client that uses that call, even if the new parameters have default values, because the FC reflection API does not understand how to interact with default values due to underlying deficiencies in C++
In this ticket, I propose a solution to this problem: Most or all API calls should be rewritten to take a single
struct
, containing the values that were previously passed as separate arguments. Defaults can then be placed in the C++struct
definition, and if some fields do not occur in the JSON dictionary provided by the client, then those fields should not be assigned by the API framework and thus will have their default values.I should test that the API framework does in fact give fields that do not exist in the JSON object their default values.
The text was updated successfully, but these errors were encountered: