graphql-to-elm
graphql-to-elm copied to clipboard
Multiple fragments generate mutually exclusive records
Given schema
type Query {
books: [Book]
}
type Book {
title: String
author: String
}
query
query {
books {
...foo
...bar
}
}
fragment foo on Book {
title
}
fragment bar on Book {
author
}
generates a type that is either Book
(title
) OR Book2
(author
)
type alias Query =
{ books : Maybe.Maybe (List (Maybe.Maybe Book3))
}
type Book3
= OnBook Book
| OnBook2 Book2
type alias Book =
{ title : Maybe.Maybe String
}
type alias Book2 =
{ author : Maybe.Maybe String
}
while expected is a plain record with both title
AND author
type alias Query =
{ books : Maybe.Maybe (List (Maybe.Maybe Book))
}
type alias Book =
{ title : Maybe.Maybe String
, author : Maybe.Maybe String
}
Thank you for the report. Indeed that is not correct. I'll see if I can find some time to look into it.
I just publish v1.0.4 which should fix this issue. Please let me know if you experience any more problems.