Error decoding Structured Text

Hello. I am making a request through the apollo ios framework, but when I get a response, apollo throws an error that it cannot decode the value property. Perhaps in the request, there is a way to specify an explicit JSON type, but I do not know how to do this. Thanks for any help.

fragment LessonFragment on LessonRecord {
  id
  title
  content {
    value
    blocks {
      ... on ImageRecord {
        image {
          ...ImageFragment
        } 
      }
    }
  }
}

RESPONSE

error(Apollo.GraphQLResultError(path: course.chaptersList.0.lessonsList.0.content.value, underlying: Apollo.JSONDecodingError.couldNotConvert(value: {
    document =     {
        children =         (
                        {
                children =                 (
                                        {
                        type = span;

………………a lot of content…………….

                                type = root;
    };
    schema = dast;
}, to: Swift.String)))

Hey @Flumi, I’ve never worked with Apollo iOS, but it seems that this is related (see the “JSON and other Custom Scalars with multiple return types” chapter)!

(from Unable to read a JSON data type using Apollo - iOS client · Issue #1726 · apollographql/apollo-ios · GitHub)

1 Like