Skip to content

How to use fragments #4

Description

@MARTIMM

Hi Curt,

I have a question about how to use fragments especially how to specify the type on which it applies.
E.g. The following query works

 query pinterest ( $uri: String, $idx: Int) {
        page(uri: $uri)
        link(idx: $idx) {
          href
          text
          imageList {
            src
            alt
          }
        }
      }

the link field is handled by the GraphQL::Html::QC.link method returning a GraphQL::Html::QC::Link object and imageList by the GraphQL::Html::QC.imageList method returning an Array[GraphQL::Html::QC::Image] object.

Now I want to do this;

      fragment imgs on GraphQL::Html::QC::Link {
        imageList {
          src
          alt
        }
      }

      query pinterest ( $uri: String, $idx: Int) {
        page(uri: $uri)
        link(idx: $idx) {
          href
          text
          ...imgs
        }
      }

This does not parse because of the used module name and when I use Link, I get the error `No such method 'field' for invocant of type 'GraphQL::Types::GraphQL::LazyType'.

Regards,
Marcel

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions