awslabs / aws-mobile-appsync-sdk-ios

iOS SDK for AWS AppSync.
https://awslabs.github.io/aws-mobile-appsync-sdk-ios/
Other
262 stars 130 forks source link

Make public constructor for GraphQLError #547

Closed fo2rist closed 11 months ago

fo2rist commented 2 years ago

Is your feature request related to a problem? Please describe. I wan to test my application that uses AWS AppSync SDK, to properly cover failures I want to create different instances of GraphQLError so I can validated responses, but both constructors of GraphQLError are internal, so there is no way to do so.

Describe the solution you'd like Either make one of the constructors (init method) public or create a public extension to construct GraphQLError for test purposes. Making constructor public should not have any downsides, apart from people constructing and throwing it manually from outside the library code, but it more of style issue and won't affect the library itself. Alternatively if we want to emphasize that instances of GraphQLError should only be created for tests and extension with a clear name and doc would allow to do that.

Describe alternatives you've considered Make whole struct open — can lead to misuse

Additional context

fzy-github commented 2 years ago

@fo2rist You should be able to use internal initializers if you import AwsAppSync using @testable clause, eg:

@testable import AwsAppSync

I am using this approach to create eg. GraphQLResult objects

atierian commented 11 months ago

Thank you for opening this issue. AWS AppSync SDK for iOS entered maintenance mode in September 2023 and will receive no further updates as of September 2024.

Please use Amplify Swift going forward. For information on upgrading to Amplify Swift, refer to the Upgrade from AppSync SDK documentation.