apollographql / apollo-rs

Spec compliant GraphQL Tools in Rust.
Apache License 2.0
566 stars 45 forks source link

chore(parser): remove recursion when parsing non-nested lists of nodes #721

Closed goto-bus-stop closed 10 months ago

goto-bus-stop commented 10 months ago

GraphQL has many list-like things that have to be non-empty. In those cases I try to explicitly parse one node and error if not found, then parse with a while let if the next token indicates another of the same node is coming. I wrapped it up in a helper function/macro first but it's frankly just as much code at each usage site so I didn't find it worth it for this very small pattern.

Fixes https://github.com/apollographql/apollo-rs/issues/666 Also fixes https://github.com/apollographql/apollo-rs/issues/659, and the same for unions (union X = A || B | is now illegal)

goto-bus-stop commented 10 months ago

I think we shouldn't consider the exact number a breaking change as it is tied to the internal details of how we parse stuff. Last time the correction was increasing the number which would trigger the limit on inputs that previously didn't, which made it a breaking change. This time any input that worked in the past still works, just more inputs are accepted than before. But it's worth calling it out better in the changelog