Skip to content

Global "flatten" option for all fragment-spreads #404

@HaraldNordgren

Description

@HaraldNordgren

Is your feature request related to a problem? Please describe.
This is great: #121, and could be improved further.

Describe the solution you'd like
Add a global "flatten" option for genqlient.yaml to automatically flatten all fragments.

Describe alternatives you've considered
Adding flatten individually to all request, which I currently do, but having this would be more convenient.

Additional context
I would recommend everyone to flatten all of their fragments together with a typename, this option would make that smoother for new users. See an example from my code:

query SearchRecipeMinimal($request: SearchRecipeRequest!) {
  # @genqlient(typename: "SearchRecipeMinimalResult")
  searchRecipe(req: $request) {
    # @genqlient(flatten: true)
    recipes {
      ...FoodItemTypeMinimal
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions