Skip to content

Allow to exclude fields from generated GraphQL objects #1297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sabirove opened this issue Aug 4, 2023 · 1 comment
Closed

Allow to exclude fields from generated GraphQL objects #1297

sabirove opened this issue Aug 4, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@sabirove
Copy link
Contributor

sabirove commented Aug 4, 2023

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
@jxnu-liguobin jxnu-liguobin added the enhancement New feature or request label Aug 4, 2023
kobylynskyi pushed a commit that referenced this issue Aug 9, 2023
@kobylynskyi kobylynskyi added this to the 5.8.1 milestone Aug 9, 2023
@kobylynskyi
Copy link
Owner

Thanks @sabirove for working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants