graphql-spqr-spring-boot-starter icon indicating copy to clipboard operation
graphql-spqr-spring-boot-starter copied to clipboard

Throw exception on type clash

Open benneq opened this issue 6 years ago • 2 comments

I just created two @Services with clashing method names:

@Service
@GraphQLApi
public class MyService1 {
  @GraphQLMutation
  public String foo() {
    return "1";
  }
}

@Service
@GraphQLApi
public class MyService2 {
  @GraphQLMutation
  public String foo() {
    return "2";
  }
}

Now it's completely random (changes every time I restart the application) which of those 2 methods gets called.

I think it would be best, if the auto configuration throws an exception, when adding a GraphQL Type that already exists.

benneq avatar Aug 19 '18 14:08 benneq

Hi, I'll start working on updating the starter to work with 0.9.8 since it's out now. I'll look at this issue while I do that and keep you up to date.

BaldyLocks avatar Aug 20 '18 07:08 BaldyLocks

I discussed this with @kaqqao and this should be prevented by underlying SPQR itself in some future version. What I can do is add a stopgap measure in the starter and as you said throw an exception. 0.0.2 should come around this weekend with extended support for SPQR 0.9.8 features, so this check will probably come in 0.0.3

BaldyLocks avatar Aug 21 '18 19:08 BaldyLocks