We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When trying to compile a json file with the following command
python json-to-elm/generate.py src/shared/person.json > src/client/decoders/Person.elm
It generates the following:
type alias Person = { name : String , age : Int , location : PersonLocation } type alias PersonLocation = { name : String , days : Int } decodePerson : Json.Decode.Decoder Person decodePerson = Json.Decode.succeed Person |: ("name" := Json.Decode.string) |: ("age" := Json.Decode.int) |: ("location" := decodePersonLocation) decodePersonLocation : Json.Decode.Decoder PersonLocation decodePersonLocation = Json.Decode.succeed PersonLocation |: ("name" := Json.Decode.string) |: ("days" := Json.Decode.int) encodePerson : Person -> Json.Encode.Value encodePerson record = Json.Encode.object [ ("name", Json.Encode.string <| record.name) , ("age", Json.Encode.int <| record.age) , ("location", encodePersonLocation <| record.location) ] encodePersonLocation : PersonLocation -> Json.Encode.Value encodePersonLocation record = Json.Encode.object [ ("name", Json.Encode.string <| record.name) , ("days", Json.Encode.int <| record.days) ]
whereas I would expect it to compile to the latest version as follows:
import Json.Encode import Json.Decode import Json.Decode.Pipeline type alias Person = { name : String , age : Int , location : PersonLocation } type alias PersonLocation = { name : String , days : Int } decodePerson : Json.Decode.Decoder Person decodePerson = Json.Decode.Pipeline.decode Person |> Json.Decode.Pipeline.required "name" (Json.Decode.string) |> Json.Decode.Pipeline.required "age" (Json.Decode.int) |> Json.Decode.Pipeline.required "location" (decodePersonLocation) decodePersonLocation : Json.Decode.Decoder PersonLocation decodePersonLocation = Json.Decode.Pipeline.decode PersonLocation |> Json.Decode.Pipeline.required "name" (Json.Decode.string) |> Json.Decode.Pipeline.required "days" (Json.Decode.int) encodePerson : Person -> Json.Encode.Value encodePerson record = Json.Encode.object [ ("name", Json.Encode.string <| record.name) , ("age", Json.Encode.int <| record.age) , ("location", encodePersonLocation <| record.location) ] encodePersonLocation : PersonLocation -> Json.Encode.Value encodePersonLocation record = Json.Encode.object [ ("name", Json.Encode.string <| record.name) , ("days", Json.Encode.int <| record.days) ]
or at least add options to include imports and which version to compile to.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When trying to compile a json file with the following command
python json-to-elm/generate.py src/shared/person.json > src/client/decoders/Person.elm
It generates the following:
whereas I would expect it to compile to the latest version as follows:
or at least add options to include imports and which version to compile to.
The text was updated successfully, but these errors were encountered: