-
-
Notifications
You must be signed in to change notification settings - Fork 80
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
AI Policy
- I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Versions
elixir 1.18.4
ash 3.6.2
ash_graphql 1.8.3
Operating system
Linux docker container on macOS
Current Behavior
I haven't verified all different potential iterations of this bug, but I have an application that does not make use of graphql subscriptions. I recently added a resource modeling a "subscription" within my application, and named its graphql type :subscription. I noticed that in the generated graphql schema file, the schema now had a subscription key in the root schema, like this:
schema {
mutation: RootMutationType
query: RootQueryType
subscription: Subscription
}with type Subscription having my subscription resource's fields
where it had previously (and still does if I change the type name to anything other than subscription) looked like this:
schema {
mutation: RootMutationType
query: RootQueryType
}I assume this is because Subscription is effectively a reserved type name for graphql subscriptions. I'm not sure what would happen here if this occurred in an application that did use graphql subscriptions, but I suspect these would overlap in a more catastrophic way (my application did still compile).
Reproduction
- create a resource called
MyApp.Domain.Subscriptionwith any attributes - it should use the
AshGraphql.Resourceextension, have a graphqltypeof:subscription, and wire up a query of some sort so it does show up in the schema file - generate the sdl file
- see the behavior described
Expected Behavior
I think the easiest way to avoid this would be to simply raise if a graphql type is called subscription, since that type name is effectively reserved by ash_graphql.
The name of the internal subscription type could also be made configurable, which would allow users to name a type subscription if they explicitly rename the internal subscription type.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status