-
-
Notifications
You must be signed in to change notification settings - Fork 494
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
Introduce support for deserializing via annotated constructor #653
Conversation
… allow read-only fields and properties.
Hi! Thanks for this. I did some experiments and overall it's working quite well. I found some problems, though:
I also tested anchors and even indirect circular references, which work correctly. Let me know what are your thoughts on the above. Thanks |
Great! I'll reply to each inline but the summary would be:
Agreed. How would you prefer we determine the need to use the constructor (rather than
Funny you should mention that, I was thinking exactly the same right after submitting my PR! 😁 Would you prefer adding the needed functionality to the new
Fair. I figured the best way to address would be a
Ooh! Great. I hadn't looked at either of those so that's great to hear! With my local copy sufficing for my needs for now, I've moved away from the YamlDotNet source for now. For this reason I worry that if we block integration of the functionality as is, it just delays its use by others. Depending on workload and complexity of solutions proposed, I'm happy to add the extra bits above but I hesitate to commit to timeline above "the next few months". Perhaps create GH "Issue" for all/each and assign to me and I'll pick them off as I go (or on-demand if users vote their desire)? Thanks for such a useful library btw! We're prototyping using it as persistence format for an indie game we're developing. |
Doing a little more work on this. Updates inline.
I have this working locally now.
Working on this next.
Not yet looked at this. Might you accept an updated PR that contains the other two to start? |
a0f8359
to
78b1ab3
Compare
This PR appears to be abandoned, it's nearly a year old. I'm going to close it. |
Introduce support for deserializing via annotated constructor call to allow read-only fields and properties.
Annotate a constructor with the new
YamlConstructorAttribute
and it will be used in preference to property and field setting.Unit test added. It's largely copied from
ObjectNodeDeserializer
plus some tests to prove certain desirable behaviours. It's showing 81% coverage of the new codeAnnotatedConstructorObjectNodeDeserializer
. Missed lines are all corner cases (errors, theIValuePromise
bits and non-use code-paths).