Fix TH generation for GraphQL input objects (#276)

This commit is contained in:
Alejandro Serrano 2021-01-08 09:40:06 +01:00 committed by GitHub
parent e9d55fd6bf
commit b56357c0b7
2 changed files with 4 additions and 3 deletions

View File

@ -37,6 +37,7 @@ jobs:
sudo apt-get install ruby-dev
sudo gem install bundler --force
sudo gem update --system
sudo bundle update --bundler
sudo bundle install --gemfile docs/Gemfile --path vendor/bundle
- name: Build microsite from last release
run: |

View File

@ -194,11 +194,11 @@ typeToDec _ _ _ (GQL.InputObjectTypeDefinition _ name _ fields) =
ginputTypeToType (GQL.TypeNonNull (GQL.NonNullTypeNamed a)) =
[t| $(typeToPrimType a) |]
ginputTypeToType (GQL.TypeNonNull (GQL.NonNullTypeList a)) =
[t| 'ListRef $(ginputTypeToType a) |]
[t| 'TList $(ginputTypeToType a) |]
ginputTypeToType (GQL.TypeNamed a) =
[t| 'OptionalRef $(typeToPrimType a) |]
[t| 'TOption $(typeToPrimType a) |]
ginputTypeToType (GQL.TypeList a) =
[t| 'OptionalRef ('ListRef $(ginputTypeToType a)) |]
[t| 'TOption ('TList $(ginputTypeToType a)) |]
typeToPrimType :: GQL.Name -> Q Type
typeToPrimType "Int" = [t|'TPrimitive Integer|]
typeToPrimType "Float" = [t|'TPrimitive Double|]