All Downloads are FREE. Search and download functionalities are using the official Maven repository.

elm.recordDecoder.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{#discriminator}}
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}Decoder : Json.Decode.Decoder {{classname}}
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}Decoder =
    Json.Decode.field "{{{propertyName}}}" Json.Decode.string
        |> Json.Decode.andThen {{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}TagDecoder


{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}TagDecoder : String -> Json.Decode.Decoder {{classname}}
{{#lambda.camelcase}}{{classname}}{{/lambda.camelcase}}TagDecoder tag =
    case tag of
{{#mappedModels}}
        "{{mappingName}}" ->
            Json.Decode.map {{classname}}{{modelName}} {{#lambda.camelcase}}{{modelName}}{{/lambda.camelcase}}Decoder

{{/mappedModels}}
        _ ->
            Json.Decode.map {{classname}} base{{classname}}Decoder


{{/discriminator}}
{{#lambda.camelcase}}{{#discriminator}}Base{{/discriminator}}{{classname}}{{/lambda.camelcase}}Decoder : Json.Decode.Decoder {{#discriminator}}Base{{/discriminator}}{{classname}}
{{#lambda.camelcase}}{{#discriminator}}Base{{/discriminator}}{{classname}}{{/lambda.camelcase}}Decoder =
    Json.Decode.succeed {{#discriminator}}Base{{/discriminator}}{{classname}}{{#parent}}{{#allOf}}
        |> decodeChain {{#lambda.camelcase}}{{.}}{{/lambda.camelcase}}Decoder{{^-last}}, {{/-last}}{{/allOf}}{{/parent}}{{#vars}}
        |> {{>recordFieldDecoder}}{{/vars}}{{#vars}}{{#isEnum}}


{{>customTypeDecoder}}
{{/isEnum}}{{/vars}}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy