Skip to content
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

THRIFT-5714 add TJSONProtocol support for swift #2815

Merged
merged 2 commits into from Jun 15, 2023
Merged

Conversation

cozality
Copy link
Contributor

@cozality cozality commented Jun 6, 2023

The code contains the changes required to support TJSONProtocol in the Thrift-Swift. The codes are ported from C#.NET Thrift official library

Add support TJSONProtocol via implementing it.
Jira Ticket: https://issues.apache.org/jira/browse/THRIFT-5714

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • [x ] Did you squash your changes to a single commit? (not required, but preferred)
  • [ x] Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

The code contains the changes required to support TJSONProtocol in the Thrift-Swift. The codes are ported from C#.NET Thrift official library
@Jens-G Jens-G added the swift label Jun 7, 2023
@Jens-G Jens-G changed the title add TJSONProtocol support THRIFT-5714 add TJSONProtocol support for swift Jun 7, 2023
// Created by Khodabakhsh, Hojjat on 5/18/23.
//

import XCTest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please replace the file header by std ASF license header

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

import Foundation

public class TBase64Utils {
private static let EncodeTable: String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to implement this ourselves? Does Swift have no standard runtime library support for this that we can leverage?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imported the code from C# library and the way it has been implemented is like above, so I wanted to be consistent with that.

see https://github.com/apache/thrift/blob/master/lib/netstd/Thrift/Protocol/Utilities/TBase64Utils.cs

@cozality cozality requested a review from Jens-G June 13, 2023 23:44
@Jens-G Jens-G merged commit a2a1f53 into apache:master Jun 15, 2023
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants