Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key information validation clashes with the semantics of multi subscriptions #88

Closed
DawidNiezgodka opened this issue Sep 23, 2022 · 1 comment
Assignees
Labels
component/gateway type/bug Something isn't working

Comments

@DawidNiezgodka
Copy link
Contributor

I wanted to test multi-subscriptions using CLI. I created a gateway and applied the following schema:

type Query {
    findPurchase(purchaseId: String): Purchase @topic(name: "purchase", keyArgument: "purchaseId")
    allPurchases: [Purchase!] @topic(name: "purchase")
}

type Purchase {
    purchaseId: String!
    productId: Int!
    userId: Int!
    product: Product @topic(name: "product", keyField: "productId")
    amount: Int
    price: Price
}

type Product {
    productId: Int!
    name: String
    description: String
    price: Price
}

type Price {
    total: Float
    currency: String
}

type Click {
    userId: Int!
    timestamp: Int
}

type Subscription {
    userStatistics: UserStatistics
}

type UserStatistics {
    purchase: Purchase @topic(name: "purchase")
    click: Click @topic(name: "click")
}

I received the following error: Internal Server Error: {"type":"errors/serverError","title":"Internal Server Error","code":500,"detail":"An unexpected error occurred:When the return type is not a list for a non-mutation and non-subscription type, key information (keyArgument or keyField) is needed.","uriPath":"/control/schema"} Could not apply schema to gateway: multisubstest

Investigation of the error message led me to the one of the Validation Rules - KeyInformation

The semantics of multi subscription that transfers topic directives from the Subscription type to the user-defined type clashes with this rule.

@DawidNiezgodka
Copy link
Contributor Author

This has been solved by disabling the validation rule. We will refactor the validation rules so that the one that was disabled can be enabled again. See: #94.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/gateway type/bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

1 participant