Skip to content
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

Allow SelectionSet to be defined during method call #12

Open
fabiocarvalho777 opened this issue Jul 13, 2021 · 0 comments
Open

Allow SelectionSet to be defined during method call #12

fabiocarvalho777 opened this issue Jul 13, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@fabiocarvalho777
Copy link
Member

fabiocarvalho777 commented Jul 13, 2021

Currently the custom selection set can only be defined during client API definition time (statically set with SelectionSet annotation in the GraphQL operation method). However, sometimes applications might need to set custom selection sets per method call. In order to support this use case, SelectionSet annotation can be enhanced as follows:

  1. SelectionSet annotation should be modified to be applicable to method parameters as well.
  2. Mocca should recognize the presence of a String parameter annotated with SelectionSet in the GraphQL operation method, and use it to define the selection set.
  3. A MoccaException exception should be thrown in the following cases:
    1. If SelectionSet is present at both method and parameter level
    2. If SelectionSet annotated more than one parameter
    3. If the SelectionSet annotated parameter is not a String
    4. If SelectionSet ignore field is set when used to annotate a String parameter

Important note

Similarly to when applying SelectionSet to the return type, but defining it statically as a String, if the custom selection set defined in the parameter does not match the return type, then an exception should be thrown. Developing this behavior is out of scope for this story, as it is already implemented. However, negative tests should be added to exercise this situation.

Acceptance Criteria

  1. Use case described above is implemented
  2. End user document is changed accordingly
  3. Javadocs are changed accordingly
  4. Unit and/or functional tests are added
  5. Make sure to add negative tests as well
@fabiocarvalho777 fabiocarvalho777 changed the title Enhance SelectionSet annotation Allow SelectionSet to be defined during method call Aug 10, 2021
@fabiocarvalho777 fabiocarvalho777 added the enhancement New feature or request label Aug 10, 2021
@fabiocarvalho777 fabiocarvalho777 added this to the 0.0.4 milestone Sep 21, 2021
@fabiocarvalho777 fabiocarvalho777 modified the milestones: 0.0.4, 0.0.5, 0.0.6 Jan 8, 2022
@fabiocarvalho777 fabiocarvalho777 modified the milestones: 0.0.6, 0.0.7 Jan 28, 2022
@fabiocarvalho777 fabiocarvalho777 removed this from the 0.0.7 milestone May 4, 2023
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

1 participant