Skip to content

Allow to exclude fields from generated GraphQL objects #1297

Closed
@sabirove

Description

@sabirove

Current behaviour

  • When resolvers are specified for a field via fieldsWithResolver, the field is excluded from the object being generated
  • When resolvers are not specified, the field is included in the object being generated

The problem

Adding ad-hoc resolvers that are outside the plugin scope is impossible because the field will always be generated.

Use case: if I want to add a custom @BatchMapping resolver it will either conflict with the "singular" one generated by the plugin or, if resolver generation is disabled we will end up with the field in the object that we don't want

Suggested solution

Add extra plugin option to allow excluding specified fields from generation, e.g.

        <parameter>
          <name>fieldsExcludedFromGeneration</name>
          <type>java.lang.String[]</type>
          <required>false</required>
          <editable>true</editable>
          <description></description>
        </parameter>

Expected behavior:

  • if field is added in fieldsExcludedFromGeneration it is excluded from generation (not present within the object)
  • if field is added both in fieldsExcludedFromGeneration and in fieldsWithResolver it is excluded from generation
  • if field is added both in fieldsExcludedFromGeneration and in fieldsWithoutResolver it is excluded from generation

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions