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

Edgecase where no flat field can be selected at the maximum depth #12

Open
Alan-Cha opened this issue Jul 22, 2020 · 3 comments
Open

Edgecase where no flat field can be selected at the maximum depth #12

Alan-Cha opened this issue Jul 22, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@Alan-Cha
Copy link
Contributor

An error is thrown if a query hits the defined maxDepth, but there are only fields with children to choose from. Choosing such a field but then not choosing a sub-field for it (due to the maxDepth constraint) would result in an invalid query and thus causes this library to throw an error.

@Alan-Cha
Copy link
Contributor Author

#9 Will address this issue by adding the meta field __typefield however I have concerns about this will be a confusing change to our users. Normally __typefield will be added as a part of union and interface use cases however, in this case, we will be adding the meta field wherever necessary.

I believe that this is still a good change overall but I think in future, we should look into properly solving the issue by recursively ensuring that there are fields that can be added without violating the maxDepth rule.

@Alan-Cha Alan-Cha added the enhancement New feature or request label Jul 23, 2020
@alexkrolick
Copy link

Would it be possible to add an option to soft-enforce the maxDepth rule for this case? Otherwise it's difficult to run random queries as an automated fuzz testing suite, because the tests hard fail randomly.

@Alan-Cha
Copy link
Contributor Author

Alan-Cha commented Mar 5, 2021

@alexkrolick I'm currently working on a number of other projects so it is difficult for me to look at this right now.

We have experienced problems due to this issue and in the past, one of our workarounds was to simply create a helper function that wraps the query generator in a try/catch block and a while loop. I know this is far from ideal but until I can find some time to look into this issue, I will have to rely on external contributions to help resolve this issue.

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

2 participants