Skip to content

Is it possible to separate GraphQL codegen for inputs and mutations? #1794

@ashleyxue529

Description

@ashleyxue529

For example, I want to use the generated input type of the graphql create action for an ent, but I don't want to surface the create mutation itself.

My current setup uses nested ent input objects for one main top level create mutation; I haven't quite figured out the best way to do it. Right now I'm using this, but it's not quite what I need:

actions: [
    {
      operation: ActionOperation.Create,
      inputName: "CreateObjectInput",
      actionOnlyFields: [
        {
          name: "objectLayers",
          type: "Object",
          actionName: "CreateObjectLayerAction", <- this mutation is shown in graphiql, but i dont need it, only the input type
          list: true,
        },
        {
          name: "objectImages",
          type: "Object",
          actionName: "CreateObjectImageAction",
          list: true,
        },
      ],
    },

I guess more generally what I'm looking for is the ability to define CUD input types derived from the EntSchema classes and use those wherever I need them. Slightly related to #1754 as I'm using this current setup as a workaround for not being able to easily nest input object types.

Also looking for the ability to reuse input types. E.g. a general CreateObjectInput can be used in multiple places, currently having some issues using the same variable names for different mutations for similar types...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions