graphql-api icon indicating copy to clipboard operation
graphql-api copied to clipboard

Fix issue with inability to parse mandatory types

Open fredefox opened this issue 5 years ago • 3 comments

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 avatar Aug 07 '19 20:08 fredefox

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

fredefox avatar Aug 07 '19 20:08 fredefox

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

teh avatar Aug 12 '19 19:08 teh

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.

fredefox avatar Aug 15 '19 07:08 fredefox