feat: better Serializer for MutableConfigValue - #8421
Conversation
|
prev discussion about why we need a custom serializer implementation: #8400 |
|
Please update the title according to https://github.com/near/nearcore/blob/master/CONTRIBUTING.md#pull-requests For example: "feat: Better |
| /// See `expected_shutdown` for an example how to use it. | ||
| /// TODO: custom implementation for Serialize and Deserialize s.t. only value is necessary(JIRA:ND-283) | ||
| #[derive(Clone, Debug, Serialize, Deserialize)] | ||
| #[derive(Clone, Debug, Deserialize)] |
There was a problem hiding this comment.
The derived implementation of Deserialize is not compatible with the custom Serialize implementation. Please consider removing the derived Deserialize implementation.
There was a problem hiding this comment.
I removed the derived deserializer for RpcClientConfigResponse, ClientConfig and MutableConfigValue. The /client_config is still working perfectly fine locally. Tested and confirmed serializer is needed here.
Also removed derived Debug for RpcClientConfigRequest and RpcClientConfigResponse as Debug does not seem necessary.
MutableConfigValue
MutableConfigValueSerializer for MutableConfigValue
* better Serializer for MutableConfigValue: only display value to users * remove derived Deserialize and DEBUG for RpcClientConfigResponse, ClientConfig, MutableConfigValue * remove RpcClientConfigRequest
When we enable dynamically config, we use a MutableConfigValue type to represent the mutable fields.
Only value field is valuable to end users. This PR aims to only show MutableConfigValue.value to users and hide the other 2 fields.
For example, if you navigate to /debug/client_config, and look at the field
expected_shutdown, this PR should show"expected_shutdown": "null"instead of
"expected_shutdown: "expected_shutdown":{"value":null,"field_name":"expected_shutdown","last_update":"2023-01-23T19:26:43.817152Z"}