Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
453 stars 198 forks source link

Access Level Update for AbstractResponse.rawFields property #1192

Closed mahmutpinarbasi closed 1 year ago

mahmutpinarbasi commented 1 year ago

Hi,

With latest 10.0.0 [2023-01] release, rawFields ( previously fields) property access level changed to internal on AbstractResponse class. which is kind a breaking change for entire serialize/deserialize operation on our app. So wondering was it intentional? Is it possible to switch back to public access level again?

You can also see the similar usage on mobile-buy-sdk-ios-sample

Screen Shot 2023-01-31 at 01 04 05

If you guys ok with it; I can create the PR. what do you think @cocoahero ?

cocoahero commented 1 year ago

Hi @mahmutpinarbasi - yes this was intentional as the previous property name was conflicting with a newly added schema field. We made it internal so that it would be easier to fix in the future if this were to happen again.

Curious how you are using this property? What serialization/deserialization are you having to do that the built in model objects do not provide?

mahmutpinarbasi commented 1 year ago

Hi @cocoahero,

My usage is as following;

extension GraphQL.AbstractResponse: Serializable {

    static func deserialize(from representation: SerializedRepresentation) -> Self? {
        return try? self.init(fields: representation)
    }

    func serialize() -> SerializedRepresentation {
        return self.fields
    }
}

We are using similar infrastructure on our app with buy sdk example app. You can get more details about the usage from here: https://github.com/Shopify/mobile-buy-sdk-ios-sample/blob/0565810b86227df0a0211d38490718e1f9f5eb7b/Storefront/GraphQL%2BSerializable.swift

cocoahero commented 1 year ago

Hi @mahmutpinarbasi - please see the above linked PR and let me know if that will solve for your use case.

mahmutpinarbasi commented 1 year ago

Hi @cocoahero,

It perfectly solves the issue. Thanks for the quick action.

cocoahero commented 1 year ago

The PR has been shipped and v10.1 has been tagged and released. I will work on updating the sample code to reflect the changes. Thanks for letting us know.