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

apollo-smith: more varied fields generation #866

Merged
merged 5 commits into from
Jun 12, 2024
Merged

Conversation

Geal
Copy link
Contributor

@Geal Geal commented Jun 12, 2024

This changes the field generation algorithm in apollo-smith to allow more variety, because the previous implementation was too biased towards the first field specified in a type.
This also adds an example to generate a random query from a schema.

One thing that comes out of these tests is that we need the input data for Arbitrary to be large enough, otherwise once it has no more bytes to consume, it returns 0 every time and the selections get no more variations

@lrlna
Copy link
Member

lrlna commented Jun 12, 2024

This does make the snapshots fail, and I think that failure is legit. We should have some fields in the operation's selection set and the fragment's selection set

@Geal
Copy link
Contributor Author

Geal commented Jun 12, 2024

you're right, I messed up the lower bound of the range. I set it to at least 1 selection instead of 2 and updated the snapshots. We do not lose much by doing that

@lrlna lrlna merged commit 9ff692f into main Jun 12, 2024
12 checks passed
@lrlna lrlna deleted the geal/smith-vary-fields branch June 12, 2024 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants