-
Notifications
You must be signed in to change notification settings - Fork 120
Empty codingkey encode decode output #267
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
Empty codingkey encode decode output #267
Conversation
Alkenso
commented
May 12, 2023
- fix output for case when one of CodingKeys is empty string
- fix mirror decoding of encoded type where one of CodingKeys is empty string
|
@Joannis , please review. |
|
I need a bit more time for review, but could you document your intended behaviour here? That helps me review, and end users understand how encoding/decoding enum cases works. |
|
Such functionality allows the ability to Also I decided to simplify dealing with |
c896105 to
5119277
Compare
|
@Joannis , update with additional fixes |
|
@Joannis , ping |
|
Thanks for the ping! The PR was made at a very unfortunate time, so it got missed |
Joannis
left a comment
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.
Thanks for the PR, and sorry for the delayed review! Just some small changes regarding isInlined
| var string = "" | ||
| string += element._toXMLString(indented: level + 1, escapedCharacters, formatting, indentation) | ||
| string += prettyPrinted ? "\n" : "" | ||
| let indentLevel = !isInlided ? level + 1 : level |
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.
Reverse the ternary, making it easier to parse
| let indentLevel = !isInlided ? level + 1 : level | |
| let indentLevel = isInlined ? level : level + 1 |
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.
done
|
|
||
| extension XMLKeyedDecodingContainer { | ||
| internal init?(box: Box, decoder: XMLDecoderImplementation) { | ||
| if let keyedContainer = box as? KeyedContainer { |
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.
Should be a switch instead. Switch statements are a bit faster.
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.
switch box {
case let container as KeyedContainer:
...
default:
return nil
}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.
done
a6eb8eb to
31c3936
Compare
Joannis
left a comment
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.
Thanks for the PR! I'll test it myself, and publish it later
|
@Alkenso CI's failing on your changes: https://github.com/CoreOffice/XMLCoder/actions/runs/5207978882/jobs/9425283354?pr=267 |
|
@Joannis , I dont know how it is possible. Locally all builds fine. Please check on yours Extension of protocol CodingKey adds method |
|
@Joannis , please re-run CI. Maybe the CI issue could occur because I've made force-push of last commit instead making new one? |
|
I did re-run it a couple of times, but the CI keeps failing to spin up a worker. I don't know what is going on at Github.. |
|
@Joannis , lets revive this PR. Probably we can move to Xcode 14-15 for builds |
|
@Alkenso Yeah, I think that's a good plan. |
