graphql-java-tools icon indicating copy to clipboard operation
graphql-java-tools copied to clipboard

Unable to use multiple interfaces

Open nnrudakov opened this issue 5 years ago • 0 comments

Hello

Kotlin: v1.4.10 graphql-spring-boot-starter: 8.0.0 graphql-java-tools: 6.2.0

Schema:

enum PayloadStatus {
    OK,
    ERROR
}

enum ProblemStatus {
    TOKEN
    QUEUE
}

interface MutationPayload {
    operationId: ID!
    status: PayloadStatus!
    errors: [MutationProblemInterface!]
}

interface MutationProblemInterface {
    status: ProblemStatus!
    message: String!
}

type AuthMutationPayload implements MutationPayload {
    operationId: ID!
    status: PayloadStatus!
    errors: [UnableTokenCheckProblem!]
}

type UnableTokenCheckProblem implements MutationProblemInterface {
    status: ProblemStatus!
    message: String!
}

type OfficialPayload implements MutationPayload {
    operationId: ID!
    status: PayloadStatus!
    errors: [UnablePutToQueueProblem!]
}

type UnablePutToQueueProblem implements MutationProblemInterface {
    status: ProblemStatus!
    message: String!
}

Code:

interface MutationProblemInterface {
    val status: ProblemStatus
    var message: String
}

class UnableTokenCheckProblem(
    override val status: ProblemStatus = ProblemStatus.TOKEN,
    override var message: String
) : MutationProblemInterface

class UnablePutToQueueProblem(
    override val status: ProblemStatus = ProblemStatus.TOKEN,
    override var message: String
) : MutationProblemInterface

Gets error:

Failed to instantiate [graphql.kickstart.tools.SchemaParser]: Factory method 'schemaParser' threw exception; nested exception is graphql.kickstart.tools.SchemaClassScannerError: Error creating bimap of type => class
...
value already present: interface MutationProblemInterface

Why?

nnrudakov avatar Oct 21 '20 12:10 nnrudakov