Closed rbino closed 7 months ago
We currently have the option: generate_object?
which does this, but it doesn't make type
optional. It would make sense for us to only require it if the type is necessary. generate_object?
should be reserved for "I need an object type but I want to define it msyelf"
Right, generate_type?
expresses the wrong idea.
Alternative proposals: object_type? false
, without_object? true
, actions_only? true
, generic_only? true
.
Let me know what you think it's best (or if you have better suggestions), then I can try to take a stab at this
Even though generate_object?
is not the best name, I think it does everything we want it to currently. The main thing is just not to require type
if we don't have to. I think it's safe to do that, and won't constitute a breaking change as long as we only skip generating the type in the appropriate cases. The reason for this is that absinthe already prunes unused types, so those users already wouldn't have seen said type in their schema.
So what really needs to happen is something like this:
type
optionalgenerate_object?
is not false
, then we raise an error there telling them that we require a type.
Is your feature request related to a problem? Please describe. I am working on a resource that only needs to expose a single generic action. In that case, since the resource itself is never exposed in GraphQL, the
type
option is actually not needed, but AshGraphql requires me to provide one.Describe the solution you'd like To avoid breaking compatiblity and ensure that the choice is informed I think there should be an additional option (e.g.
generate_type? false
) and eithertype
orgenerate_type? false
has to be provided.Alternatively,
type
could be enforced only for resources that expose some non-generic action.Describe alternatives you've considered The main alternative right now is moving the generic action in another resource that already has a connected type.
Express the feature either with a change to resource syntax, or with a change to the resource interface