Open entropic77 opened 11 months ago
This is a query for the Magento API, used to get a shopping cart with products:
fragment SimpleProduct on SimpleProduct { sku } fragment VirtualProduct on VirtualProduct { sku } fragment DownloadableProduct on DownloadableProduct { sku } fragment ConfigurableProduct on ConfigurableProduct { sku } fragment BundleProduct on BundleProduct { sku } fragment GroupedProduct on GroupedProduct { sku } fragment CartItem on CartItemInterface { __typename ...on SimpleCartItem { product { ...Product } } ...on VirtualCartItem { product { ...Product } } ...on DownloadableCartItem { product { ...Product } } ...on ConfigurableCartItem { product { ...Product } } ...on BundleCartItem { product { ...Product } } } fragment Product on ProductInterface { __typename ... on SimpleProduct { ...SimpleProduct } ... on VirtualProduct { ...VirtualProduct } ... on DownloadableProduct { ...DownloadableProduct } ... on ConfigurableProduct { ...ConfigurableProduct } ... on BundleProduct { ...BundleProduct } ... on GroupedProduct { ...GroupedProduct } } query getCart($cartId: String!) { cart(cart_id: $cartId) { items { ...CartItem } } }
It will generate the file Fragments/Product.elm containing the following decoder:
Fragments/Product.elm
decoder : Int -> Json.Decode.Decoder (b -> b) -> Json.Decode.Decoder b
Compiling this will fail with:
The argument is: Json.Decode.Decoder (b1 -> b1) But (|>) is piping it to a function that expects: Json.Decode.Decoder (Product_Specifics -> b)
Changing it to this will make it compile and work:
decoder : Int -> Json.Decode.Decoder (Product_Specifics -> b) -> Json.Decode.Decoder b
This is a query for the Magento API, used to get a shopping cart with products:
It will generate the file
Fragments/Product.elm
containing the following decoder:Compiling this will fail with:
Changing it to this will make it compile and work: