Skip to content

"non-public interface is not defined by the given loader " when using input Projections for Mutations #333

Closed
@jfrense

Description

@jfrense

I am trying to use a projected payload interface for input mappings for a given mutation.

Given the following Schema:

type Mutation {
    updateOrderState(orderUpdateInput: OrderUpdateInput!): Order
}

input OrderUpdateInput {
    id: String

}

And the following mutation defined in the controller:

@MutationMapping
    public Optional<PurchaseOrder> updateOrderState(@Argument OrderUpdateInputProjection orderUpdateInput){


        return orderRepository.findById(UUID.fromString(orderUpdateInput.getId()));

    }


    @ProjectedPayload
    interface OrderUpdateInputProjection {

        @Value("#{target.id}")
        String getId();

    }

With the following graphql call on the client side:

mutation UpdateOrderState($input: OrderUpdateInput!) {
  updateOrderState(orderUpdateInput: $input) {
    id
  }
}

and the query variables defined:

{
  "input": {
   "id": "d2494427-6f14-44de-88f3-d29abae54fed"
  }
}

I get the following error response:

{
  "errors": [
    {
      "message": "non-public interface is not defined by the given loader",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "updateOrderState"
      ],
      "extensions": {
        "classification": "INTERNAL_ERROR"
      }
    }
  ],
  "data": {
    "updateOrderState": null
  }
}

I am following this guidance from the docs : https://docs.spring.io/spring-graphql/docs/1.0.0-M5/reference/html/#controllers-schema-mapping-projectedpayload-argument

^^ is there something I'm missing to get this to work?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions