-
Notifications
You must be signed in to change notification settings - Fork 160
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
make ProgramJson
serializable
#1286
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% convinced this is the right solution. That said, I'm willing to merge something like this mostly because it's harmless for the most part. ProgramJson
is out of the hot path so it's less likely to change and break the serialization format.
That said, we need tests for this, at the very least unit tests but preferably integration tests too to see how the feature is used, etc.
Not sure how to write a meaningful test for this, we only need it to convert This is our use case for it: |
I'd be happy enough with something with a logic like the following:
The logic seems convoluted, but it'll save you from considering all the irrelevant differences that might come from formatting or field ordering if comparing the raw strings, while ensuring future changes remain compatible with that text representation.
All API surface needs to consider a bit more than the special cases that point out a need, as it always come with some maintenance baggage. I don't intend to be a PITA, I'm just trying to make sure we don't create problems for downstream users and collaborators (including you) in the future. Serialization format is part of that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, sorry I didn't notice the new changes!
It looks ready to merge except for a last suggestion.
attributes: program.shared_program_data.error_message_attributes.clone(), | ||
debug_info: program | ||
impl From<Program> for ProgramJson { | ||
fn from(program: Program) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's take a reference here. Since we're already cloning the contents there's no need to drop the old instance.
This implementation is done here #1458 |
Resolves #1183