Skip to content
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

Update for 0.19 #45

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ before_install:
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
# install elm
- npm install -g elm@0.18.0
- npm install -g elm@0.19.0

# This line does all of the work: installs GHC if necessary, build the library,
# executables, and test suites, and runs the test suites. --no-terminal works
Expand All @@ -32,3 +32,4 @@ script: stack $ARGS --no-terminal --install-ghc test --haddock --no-haddock-deps
cache:
directories:
- $HOME/.stack
- $HOME/.elm
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ import Json.Decode.Pipeline exposing (..)
import Json.Encode
import Http
import String
import Url


type alias Book =
Expand All @@ -80,7 +81,7 @@ type alias Book =

decodeBook : Decoder Book
decodeBook =
decode Book
succeed Book
|> required "name" string

getBooksByBookId : Int -> Http.Request (Book)
Expand All @@ -94,7 +95,7 @@ getBooksByBookId capture_bookId =
String.join "/"
[ ""
, "books"
, capture_bookId |> toString |> Http.encodeUri
, capture_bookId |> String.fromInt |> Url.percentEncode
]
, body =
Http.emptyBody
Expand Down
17 changes: 0 additions & 17 deletions examples/books/elm-package.json

This file was deleted.

26 changes: 26 additions & 0 deletions examples/books/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "application",
"source-directories": [
"elm"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"NoRedInk/elm-json-decode-pipeline": "1.0.0",
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/json": "1.0.0",
"elm/url": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
5 changes: 3 additions & 2 deletions examples/books/elm/Generated/BooksApi.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Json.Decode.Pipeline exposing (..)
import Json.Encode
import Http
import String
import Url


type alias Book =
Expand All @@ -13,7 +14,7 @@ type alias Book =

decodeBook : Decoder Book
decodeBook =
decode Book
succeed Book
|> required "name" string

encodeBook : Book -> Json.Encode.Value
Expand Down Expand Up @@ -77,7 +78,7 @@ getBooksByBookId capture_bookId =
String.join "/"
[ "http://localhost:8000"
, "books"
, capture_bookId |> toString |> Http.encodeUri
, capture_bookId |> String.fromInt |> Url.percentEncode
]
, body =
Http.emptyBody
Expand Down
17 changes: 0 additions & 17 deletions examples/e2e-tests/elm-package.json

This file was deleted.

26 changes: 26 additions & 0 deletions examples/e2e-tests/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "application",
"source-directories": [
"elm"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"NoRedInk/elm-json-decode-pipeline": "1.0.0",
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/json": "1.0.0",
"elm/url": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
19 changes: 10 additions & 9 deletions examples/e2e-tests/elm/Generated/Api.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Json.Decode.Pipeline exposing (..)
import Json.Encode
import Http
import String
import Url


type alias Response =
Expand All @@ -13,7 +14,7 @@ type alias Response =

decodeResponse : Decoder Response
decodeResponse =
decode Response
succeed Response
|> required "origin" string

type NoContent
Expand All @@ -31,7 +32,7 @@ encodeMessageBody x =

decodeMessageBody : Decoder MessageBody
decodeMessageBody =
decode MessageBody
succeed MessageBody
|> required "message" string

type alias ResponseWithJson =
Expand All @@ -40,7 +41,7 @@ type alias ResponseWithJson =

decodeResponseWithJson : Decoder ResponseWithJson
decodeResponseWithJson =
decode ResponseWithJson
succeed ResponseWithJson
|> required "json" decodeMessageBody

type alias QueryArgs =
Expand All @@ -49,7 +50,7 @@ type alias QueryArgs =

decodeQueryArgs : Decoder QueryArgs
decodeQueryArgs =
decode QueryArgs
succeed QueryArgs
|> required "q" string

type alias ResponseWithArgs =
Expand All @@ -58,7 +59,7 @@ type alias ResponseWithArgs =

decodeResponseWithArgs : Decoder ResponseWithArgs
decodeResponseWithArgs =
decode ResponseWithArgs
succeed ResponseWithArgs
|> required "args" decodeQueryArgs

getIp : Http.Request (Response)
Expand Down Expand Up @@ -100,8 +101,8 @@ getStatus204 =
Http.emptyBody
, expect =
Http.expectStringResponse
(\{ body } ->
if String.isEmpty body then
(\res ->
if String.isEmpty res.body then
Ok NoContent
else
Err "Expected the response body to be empty"
Expand Down Expand Up @@ -140,7 +141,7 @@ getGet query_q =
params =
List.filter (not << String.isEmpty)
[ query_q
|> Maybe.map (Http.encodeUri >> (++) "q=")
|> Maybe.map (identity >> Url.percentEncode >> (++) "q=")
|> Maybe.withDefault ""
]
in
Expand Down Expand Up @@ -178,7 +179,7 @@ getByPath capture_path =
, url =
String.join "/"
[ "https://httpbin.org"
, capture_path |> Http.encodeUri
, capture_path |> Url.percentEncode
]
, body =
Http.emptyBody
Expand Down
15 changes: 8 additions & 7 deletions examples/e2e-tests/elm/Main.elm
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
module Main exposing (..)

import Browser
import Generated.Api as Api
import Html exposing (div, img, input, button, text, li, ul, h1, dl, dd, dt)
import Http


main : Program Never Model Msg
main : Program () Model Msg
main =
Html.program
Browser.element
{ init = init
, view = view
, update = update
Expand All @@ -29,8 +30,8 @@ type MyError
| AppError String


init : ( Model, Cmd Msg )
init =
init : () -> ( Model, Cmd Msg )
init flags =
( { successGetIp = Nothing
, successGetStatus204 = Nothing
, successPostPost = Nothing
Expand Down Expand Up @@ -112,7 +113,7 @@ update action model =
if response.args.q == "Hello World" then
promoteError result
else
Err (AppError (toString response.args.q ++ " != " ++ toString "Hello World"))
Err (AppError (Debug.toString response.args.q ++ " != " ++ Debug.toString "Hello World"))

Err _ ->
promoteError result
Expand Down Expand Up @@ -164,10 +165,10 @@ viewResult name success =
( ": Waiting...", "" )

Just (Err e) ->
( ": Error", toString e )
( ": Error", Debug.toString e )

Just (Ok x) ->
( ": Ok", toString x )
( ": Ok", Debug.toString x )
in
[ dt [] [ text (name ++ status) ]
, dd [] [ text content ]
Expand Down
17 changes: 0 additions & 17 deletions examples/giphy/elm-package.json

This file was deleted.

26 changes: 26 additions & 0 deletions examples/giphy/elm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"type": "application",
"source-directories": [
"elm"
],
"elm-version": "0.19.0",
"dependencies": {
"direct": {
"NoRedInk/elm-json-decode-pipeline": "1.0.0",
"elm/browser": "1.0.0",
"elm/core": "1.0.0",
"elm/html": "1.0.0",
"elm/http": "1.0.0",
"elm/json": "1.0.0",
"elm/url": "1.0.0"
},
"indirect": {
"elm/time": "1.0.0",
"elm/virtual-dom": "1.0.0"
}
},
"test-dependencies": {
"direct": {},
"indirect": {}
}
}
9 changes: 5 additions & 4 deletions examples/giphy/elm/Generated/GiphyApi.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Json.Decode.Pipeline exposing (..)
import Json.Encode
import Http
import String
import Url


type alias Gif =
Expand All @@ -17,12 +18,12 @@ type alias GifData =

decodeGif : Decoder Gif
decodeGif =
decode Gif
succeed Gif
|> required "data" decodeGifData

decodeGifData : Decoder GifData
decodeGifData =
decode GifData
succeed GifData
|> required "image_url" string

getRandom : Maybe (String) -> Maybe (String) -> Http.Request (Gif)
Expand All @@ -31,10 +32,10 @@ getRandom query_api_key query_tag =
params =
List.filter (not << String.isEmpty)
[ query_api_key
|> Maybe.map (Http.encodeUri >> (++) "api_key=")
|> Maybe.map (identity >> Url.percentEncode >> (++) "api_key=")
|> Maybe.withDefault ""
, query_tag
|> Maybe.map (Http.encodeUri >> (++) "tag=")
|> Maybe.map (identity >> Url.percentEncode >> (++) "tag=")
|> Maybe.withDefault ""
]
in
Expand Down
Loading