mhallin/graphql_ppx

@bsField is showing up in query output

alxlu opened this issue · 4 comments

alxlu commented

When I create a fragment

module Fragment = [%graphql
  {|
    fragment testFragment on Testing {
        item
    }
    |}
];

and then I use it in another query

module Query = [%graphql
  {|
  query getAll {
    testing {
       ...Fragment.TestFragment @bsField(name: "testing")
    }
  }
     
|}
];

The output includes the @bsField(name: "testing"):

query getAll {
    testing {
      ...testFragment @bsField(name: "testing")
   }
}


fragment testFragment on Testing {
  item
}

This is on "graphql_ppx@0.2.7"

alxlu commented

nvm... I think I may be misunderstanding what @bsField is supposed to do. Removing it completely seems to work

MoOx commented

@mhallin I am facing this "bug" (not sure if that a pebcak issue or not) where I see @bsField in the javascript created by bs.
What can I do to have it gone (I understand this is something related to this ppx only? I am still new to graphql)?
Because Apollo doesn't seems to like this directive :)

@mhallin I'm sure this is a bug.
It also happens in 0.2.8
This is my query:

  module GQL = [%graphql
    {|
      query sharePropertyPage($id: ID!) {
        property(id: $id)  @bsDecoder(fn: "Property.decode") {
        images {
            id
            key
          }
        ...Fragments.PropertyBasicInfo @bsField(name: "basicInfo")
        }
      }
    |}
  ];

And @bsField(name: "basicInfo") is showing up in the output.
Can we reopen this?

Isn't the solution just to add bsField in this line?

| "bsVariant" | "bsRecord" | "bsDecoder" -> true