haskell-graphql / graphql-api

Write type-safe GraphQL services in Haskell
BSD 3-Clause "New" or "Revised" License
406 stars 35 forks source link

Fix issue with inability to parse mandatory types #222

Open fredefox opened 5 years ago

fredefox commented 5 years ago

Prior to this commit:

λ parseWith (pure mempty) type_ "[B!]!"
Done "!" (TypeList ...)

With this commit we now have:

λ parseWith (pure mempty) type_ "[B!]!"
Done "" (TypeNonNull ...)

The important thing to note here is that previous "[B!]!" was parsed as a list type (not a non-null type), but all the input was not consumed as expected. This means that whatever parser comes after would start by looking at the exclamation point, which belongs to the type.

This aims to close https://github.com/haskell-graphql/graphql-api/issues/221

fredefox commented 5 years ago

parseWith (pure mempty) -- BTW -- was a trick I came up with to inspect how much input attoparsec consumes. See http://hackage.haskell.org/package/attoparsec-0.13.2.2/docs/Data-Attoparsec-Text.html#v:parseWith

teh commented 5 years ago

Thanks! Can you change this to the value 1364? I believe that will fix the test.

fredefox commented 5 years ago

Thanks! Can you change this to the value 1364? I believe that will fix the test.

Ah cool! Thanks for providing the fix, I had just glossed over it. I will update this PR later.