apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.89k stars 730 forks source link

JSON Being Decoded As String #3458

Closed rehatkathuria closed 1 month ago

rehatkathuria commented 1 month ago

Summary

Apollo seems to be decoding types incorrectly; specifically a JSON type in my typeDefs is being decoded as a Swift.String on the client

Version

1.15.2

Steps to reproduce the behavior

  scalar DateTime
  scalar JSON

  type Notification {
    id: ID!
    created_at: DateTime!
    updated_at: DateTime!
    read: Boolean!
    read_at: DateTime
    user: User!
    sender: User!
    template: NotificationTemplate!
    params: JSON // This is the param that's being decoded incorrectly by Apollo
    link: String
  }
Apollo.GraphQLExecutionError(path: getNotifications.edges.0.node.params, underlying: ApolloAPI.JSONDecodingError.couldNotConvert(value: AnyHashable([AnyHashable("foo"): AnyHashable("bar")]), to: Swift.String))

Logs

No response

Anything else?

No response

github-actions[bot] commented 1 month ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.