-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[5.2] SR-12275: JSONEncoder on Linux can't encode number JSON fragments #2840
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
[5.2] SR-12275: JSONEncoder on Linux can't encode number JSON fragments #2840
Conversation
- JSONEncoder now encodes fragments by default to match Darwin. - JSONDecoder now allows fragments when decoding to match Darwin. - Update the following TestJSONEncoder tests now that fragments encode, these tests now pass on Darwin: test_encodingTopLevelSingleValueEnum test_encodingTopLevelSingleValueStruct test_encodingTopLevelSingleValueClass
@swift-ci test |
Whoops, should have tried locally before pushing, fixing the:
by picking the missing commit. |
@swift-ci test |
1 similar comment
@swift-ci test |
@@ -25,6 +25,8 @@ extension JSONSerialization { | |||
|
|||
public static let prettyPrinted = WritingOptions(rawValue: 1 << 0) | |||
public static let sortedKeys = WritingOptions(rawValue: 1 << 1) | |||
public static let fragmentsAllowed = WritingOptions(rawValue: 1 << 2) | |||
public static let withoutEscapingSlashes = WritingOptions(rawValue: 1 << 3) |
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.
can we add this in a 5.2 or not since it's public and adding API?
Could we still do this if we make sure no new public types are added?
WDYT @millenomi ?
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.
You can always add any API that Darwin already has.
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.
(As is the case here.)
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.
That's great to hear, thank you :-)
@swift-ci test macos |
Thanks, talked with Mishal and it's not yet going to work, but some time soon. Will ping then :) |
@swift-ci test 5.2 macos |
1 similar comment
@swift-ci test 5.2 macos |
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.
LGTM
Wohoo! Thank you @drexin @millenomi @shahmishal |
Backport of #2713 to Swift 5.2
Resolves SR-13173 Foundation.JSONEncoder + Swift 5.2.4 + .allowFragments difference between macOS and Linux
Please sanity check @millenomi, I don't think there's a reason to not backport this?
The mac behavior on 2.5.4 is already allowing this, it's just corelibs that doesn't on that version (and it's good since a while now on 5.3).
FYI @drexin
Thanks!