-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
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
[Elm] Template improvements #661
Changes from all commits
15e5e57
d7e0aff
1347b98
4f649e4
108e20a
e4fa432
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import Date | |
import Date.Extra exposing (fromIsoString, toFormattedString) | ||
import Json.Decode as Decode exposing (Decoder) | ||
import Json.Encode as Encode | ||
import Result | ||
|
||
|
||
type alias DateOnly = | ||
|
@@ -24,11 +25,8 @@ dateOnlyEncoder model = | |
decodeIsoString : String -> Decoder DateOnly | ||
decodeIsoString str = | ||
case fromIsoString str of | ||
Just date -> | ||
Result.Ok date -> | ||
Decode.succeed date | ||
|
||
Nothing -> | ||
Decode.fail <| | ||
"Cannot convert " | ||
++ str | ||
++ " to DateOnly" | ||
Result.Err msg -> | ||
Decode.fail msg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Something like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The error message in the new date-extra is
Do you still want to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well the thing is this is a |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import Date | |
import Date.Extra exposing (fromIsoString, toIsoString) | ||
import Json.Decode as Decode exposing (Decoder) | ||
import Json.Encode as Encode | ||
import Result | ||
|
||
|
||
type alias DateTime = | ||
|
@@ -24,11 +25,8 @@ dateTimeEncoder model = | |
decodeIsoString : String -> Decoder DateTime | ||
decodeIsoString str = | ||
case fromIsoString str of | ||
Just date -> | ||
Result.Ok date -> | ||
Decode.succeed date | ||
|
||
Nothing -> | ||
Decode.fail <| | ||
"Cannot convert " | ||
++ str | ||
++ " to DateTime" | ||
Result.Err msg -> | ||
Decode.fail msg | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
{{classVarName}}Decoder : Decoder {{classname}} | ||
{{classVarName}}Decoder = | ||
decode {{classname}} | ||
{{#allVars}}{{^discriminatorValue}} |> {{>fieldDecoder}} | ||
{{/discriminatorValue}}{{/allVars}} | ||
{{#allVars}} | ||
{{^discriminatorValue}} |> {{>fieldDecoder}} | ||
{{/discriminatorValue}} | ||
{{/allVars}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.0.0-SNAPSHOT | ||
3.2.0-SNAPSHOT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so as using -t allows us to regenerate the samples without doing another "mvn clean package" after updating the templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I also checked that it's used in other scripts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit weird that it sort of overloads the build, but it makes sense to add it if that's also the case for the other generators.