Skip to content

Extend rename transform to skip primitives #4684

Closed
@dr3

Description

@dr3

Is your feature request related to a problem? Please describe.

When using a number of different data sources, its nice to have a consistent name pattern between types under 1 source. Sometimes this can be handled by the prefix transform, but often you may want slightly more specific control

Describe the solution you'd like

Along side config value useRegExpForTypes, have a skipPrimitives key.

This can either be true, to skip all or an array to define the exact primitives to skip when renaming.

Example

transforms:
      - rename:
          mode: bare
          renames:
            - from:
                type: (.*)
              to:
                type: Banana$1
              useRegExpForTypes: true
              skipPrimitives: false
      - prefix:
          mode: bare
          value: v1_
          includeRootOperations: true

Which would result in

type Query {
  v1_user: v1_BananaUserProfile
}

type v1_BananaUserProfile {
  id: String!
}

In this above case, using the prefix plugin alone with value: v1_Banana would result in query v1_Bananauser which we dont want

Describe alternatives you've considered

Adding more configurability to prefix transform, or a stand alone plugin. Both I think arnt as nice as this option in the rename plugin.

Additional context

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