From 2445fa7bdcba7601ececa7e6ab8c11d292699f68 Mon Sep 17 00:00:00 2001 From: Leonardo Taglialegne Date: Tue, 24 Mar 2026 19:47:34 +0100 Subject: [PATCH 1/3] Update elm-pages bindings version --- codegen/elm.codegen.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegen/elm.codegen.json b/codegen/elm.codegen.json index fbebab53..bf8489d1 100644 --- a/codegen/elm.codegen.json +++ b/codegen/elm.codegen.json @@ -1,5 +1,5 @@ { - "elm-codegen-version": "0.6.1", + "elm-codegen-version": "0.6.3", "codegen-helpers": { "packages": { "elm/bytes": "1.0.8", @@ -8,7 +8,7 @@ "elm/json": "1.1.3", "elm-community/json-extra": "4.3.0", "elm/url": "1.0.0", - "dillonkearns/elm-pages": "11.0.0", + "dillonkearns/elm-pages": "12.1.0", "justinmimbs/time-extra": "1.2.0", "justinmimbs/date": "4.1.0", "elm/time": "1.0.0", @@ -21,4 +21,4 @@ "helpers" ] } -} \ No newline at end of file +} From 25091005edcf939a2a66b4f6bc89a177b7cfa49c Mon Sep 17 00:00:00 2001 From: Leonardo Taglialegne Date: Tue, 24 Mar 2026 19:47:47 +0100 Subject: [PATCH 2/3] Ignore @docs errors for bindings --- review/src/ReviewConfig.elm | 1 + review/suppressed/Docs.ReviewAtDocs.json | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 review/suppressed/Docs.ReviewAtDocs.json diff --git a/review/src/ReviewConfig.elm b/review/src/ReviewConfig.elm index 1acb095d..d6b63fcd 100644 --- a/review/src/ReviewConfig.elm +++ b/review/src/ReviewConfig.elm @@ -44,6 +44,7 @@ exceptCodegenRules = , Docs.ReviewLinksAndSections.rule |> Rule.ignoreErrorsForDirectories [ "src/Gen" ] , Docs.ReviewAtDocs.rule + |> Rule.ignoreErrorsForDirectories [ "src/Gen" ] , Docs.UpToDateReadmeLinks.rule , NoConfusingPrefixOperator.rule , NoDebug.Log.rule diff --git a/review/suppressed/Docs.ReviewAtDocs.json b/review/suppressed/Docs.ReviewAtDocs.json deleted file mode 100644 index e4342332..00000000 --- a/review/suppressed/Docs.ReviewAtDocs.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "version": 1, - "automatically created by": "elm-review suppress", - "learn more": "elm-review suppress --help", - "suppressions": [ - { "count": 3, "filePath": "src/Gen/BackendTask/Http.elm" }, - { "count": 3, "filePath": "src/Gen/Dict.elm" }, - { "count": 3, "filePath": "src/Gen/Http.elm" }, - { "count": 3, "filePath": "src/Gen/Result.elm" }, - { "count": 2, "filePath": "src/Gen/BackendTask.elm" }, - { "count": 2, "filePath": "src/Gen/List.elm" }, - { "count": 2, "filePath": "src/Gen/Task.elm" } - ] -} From 54b6bbf90a96554cec8dd48f09ee447cfceadad1 Mon Sep 17 00:00:00 2001 From: Leonardo Taglialegne Date: Tue, 24 Mar 2026 19:55:26 +0100 Subject: [PATCH 3/3] Use call_ bindings directly --- src/Gen/BackendTask/Http.elm | 52 ++------------------------- src/Gen/Effect/Http.elm | 65 --------------------------------- src/Gen/Http.elm | 69 ++---------------------------------- src/OpenApi/Generate.elm | 16 ++++----- 4 files changed, 13 insertions(+), 189 deletions(-) diff --git a/src/Gen/BackendTask/Http.elm b/src/Gen/BackendTask/Http.elm index fe033246..e8bd8e43 100644 --- a/src/Gen/BackendTask/Http.elm +++ b/src/Gen/BackendTask/Http.elm @@ -1,8 +1,7 @@ module Gen.BackendTask.Http exposing ( expectString, expectJson - , expectBytes, emptyBody, jsonBody + , expectBytes, emptyBody , annotation_, call_ - , bytesBody ) {-| @@ -10,9 +9,8 @@ module Gen.BackendTask.Http exposing # Generated bindings for BackendTask.Http -@docs get, expectString, expectJson -@docs expectBytes, emptyBody, jsonBody -@docs bytesBodyWithOptions +@docs expectString, expectJson +@docs expectBytes, emptyBody @docs annotation_, call_ -} @@ -138,50 +136,6 @@ emptyBody = } -{-| Builds a JSON body for a BackendTask.Http request. See [elm/http's `Http.jsonBody`](https://package.elm-lang.org/packages/elm/http/latest/Http#jsonBody). - -jsonBody: Json.Encode.Value -> BackendTask.Http.Body - --} -jsonBody : Elm.Expression -> Elm.Expression -jsonBody jsonBodyArg_ = - Elm.apply - (Elm.value - { importFrom = [ "BackendTask", "Http" ] - , name = "jsonBody" - , annotation = - Just - (Type.function - [ Type.namedWith [ "Json", "Encode" ] "Value" [] ] - (Type.namedWith [ "BackendTask", "Http" ] "Body" []) - ) - } - ) - [ jsonBodyArg_ ] - - -{-| Build a body from `Bytes` for a BackendTask.Http request. See [elm/http's `Http.bytesBody`](https://package.elm-lang.org/packages/elm/http/latest/Http#bytesBody). - -bytesBody: String -> Bytes.Bytes -> BackendTask.Http.Body - --} -bytesBody : String -> Elm.Expression -> Elm.Expression -bytesBody bytesBodyArg_ bytesBodyArg_0 = - Elm.apply - (Elm.value - { importFrom = [ "BackendTask", "Http" ] - , name = "bytesBody" - , annotation = - Just - (Type.function - [ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ] - (Type.namedWith [ "BackendTask", "Http" ] "Body" []) - ) - } - ) - [ Elm.string bytesBodyArg_, bytesBodyArg_0 ] - - annotation_ : { expect : Type.Annotation -> Type.Annotation , error : Type.Annotation diff --git a/src/Gen/Effect/Http.elm b/src/Gen/Effect/Http.elm index a8ac1ed0..5abeb962 100644 --- a/src/Gen/Effect/Http.elm +++ b/src/Gen/Effect/Http.elm @@ -1,7 +1,6 @@ module Gen.Effect.Http exposing ( bytesResolver, stringResolver , expectBytesResponse, expectStringResponse - , bytesBody, jsonBody , emptyBody, annotation_ , caseOf_, call_ ) @@ -13,7 +12,6 @@ module Gen.Effect.Http exposing @docs bytesResolver, stringResolver @docs expectBytesResponse, expectStringResponse -@docs bytesBody, jsonBody @docs emptyBody, annotation_ @docs caseOf_, call_ @@ -237,69 +235,6 @@ expectStringResponse expectStringResponseArg_ expectStringResponseArg_0 = ] -{-| {-| Put some `Bytes` in the body of your `Request`. This allows you to use -[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary -representation of the data you are sending. For example, you could create an -`archive.zip` file and send it along like this: - - import Bytes exposing (Bytes) - - zipBody : Bytes -> Body - zipBody bytes = - bytesBody "application/zip" bytes - -The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type) -of the body. In other scenarios you may want to use MIME types like `image/png` -or `image/jpeg` instead. - -**Note:** Use [`track`](#track) to track upload progress. - --} - -bytesBody: String -> Bytes.Bytes -> Effect.Http.Body - --} -bytesBody : String -> Elm.Expression -> Elm.Expression -bytesBody bytesBodyArg_ bytesBodyArg_0 = - Elm.apply - (Elm.value - { importFrom = [ "Effect", "Http" ] - , name = "bytesBody" - , annotation = - Just - (Type.function - [ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ] - (Type.namedWith [ "Effect", "Http" ] "Body" []) - ) - } - ) - [ Elm.string bytesBodyArg_, bytesBodyArg_0 ] - - -{-| {-| Put some JSON value in the body of your `Request`. This will automatically -add the `Content-Type: application/json` header. --} - -jsonBody: Json.Encode.Value -> Effect.Http.Body - --} -jsonBody : Elm.Expression -> Elm.Expression -jsonBody jsonBodyArg_ = - Elm.apply - (Elm.value - { importFrom = [ "Effect", "Http" ] - , name = "jsonBody" - , annotation = - Just - (Type.function - [ Type.namedWith [ "Json", "Encode" ] "Value" [] ] - (Type.namedWith [ "Effect", "Http" ] "Body" []) - ) - } - ) - [ jsonBodyArg_ ] - - {-| {-| Create an empty body for your `Request`. -} diff --git a/src/Gen/Http.elm b/src/Gen/Http.elm index 9acbcb7d..7e8e0a01 100644 --- a/src/Gen/Http.elm +++ b/src/Gen/Http.elm @@ -1,9 +1,7 @@ module Gen.Http exposing ( emptyBody - , jsonBody, bytesBody - , expectBytesResponse, stringResolver, bytesResolver, annotation_ + , expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_ , caseOf_, call_ - , expectStringResponse ) {-| @@ -12,10 +10,7 @@ module Gen.Http exposing # Generated bindings for Http @docs emptyBody -@docs jsonBody, bytesBody -@docs expectString -@docs trackResponse -@docs expectBytesResponse, stringResolver, bytesResolver, annotation_ +@docs expectBytesResponse, expectStringResponse, stringResolver, bytesResolver, annotation_ @docs caseOf_, call_ -} @@ -48,66 +43,6 @@ emptyBody = } -{-| Put some JSON value in the body of your `Request`. This will automatically -add the `Content-Type: application/json` header. - -jsonBody: Json.Encode.Value -> Http.Body - --} -jsonBody : Elm.Expression -> Elm.Expression -jsonBody jsonBodyArg_ = - Elm.apply - (Elm.value - { importFrom = [ "Http" ] - , name = "jsonBody" - , annotation = - Just - (Type.function - [ Type.namedWith [ "Json", "Encode" ] "Value" [] ] - (Type.namedWith [ "Http" ] "Body" []) - ) - } - ) - [ jsonBodyArg_ ] - - -{-| Put some `Bytes` in the body of your `Request`. This allows you to use -[`elm/bytes`](/packages/elm/bytes/latest) to have full control over the binary -representation of the data you are sending. For example, you could create an -`archive.zip` file and send it along like this: - - import Bytes exposing (Bytes) - - zipBody : Bytes -> Body - zipBody bytes = - bytesBody "application/zip" bytes - -The first argument is a [MIME type](https://en.wikipedia.org/wiki/Media_type) -of the body. In other scenarios you may want to use MIME types like `image/png` -or `image/jpeg` instead. - -**Note:** Use [`track`](#track) to track upload progress. - -bytesBody: String -> Bytes.Bytes -> Http.Body - --} -bytesBody : String -> Elm.Expression -> Elm.Expression -bytesBody bytesBodyArg_ bytesBodyArg_0 = - Elm.apply - (Elm.value - { importFrom = [ "Http" ] - , name = "bytesBody" - , annotation = - Just - (Type.function - [ Type.string, Type.namedWith [ "Bytes" ] "Bytes" [] ] - (Type.namedWith [ "Http" ] "Body" []) - ) - } - ) - [ Elm.string bytesBodyArg_, bytesBodyArg_0 ] - - {-| Expect a [`Response`](#Response) with a `String` body. So you could define your own [`expectJson`](#expectJson) like this: diff --git a/src/OpenApi/Generate.elm b/src/OpenApi/Generate.elm index b7853ff7..7165a694 100644 --- a/src/OpenApi/Generate.elm +++ b/src/OpenApi/Generate.elm @@ -516,9 +516,9 @@ toRequestFunctions server effectTypes method pathUrl operation = encoded = encoder <| Elm.get "body" config in - { core = Gen.Http.jsonBody encoded - , elmPages = Gen.BackendTask.Http.jsonBody encoded - , lamderaProgramTest = Gen.Effect.Http.jsonBody encoded + { core = Gen.Http.call_.jsonBody encoded + , elmPages = Gen.BackendTask.Http.call_.jsonBody encoded + , lamderaProgramTest = Gen.Effect.Http.call_.jsonBody encoded } ) @@ -539,13 +539,13 @@ toRequestFunctions server effectTypes method pathUrl operation = CliMonad.succeed <| \config -> let - toBody : (String -> Elm.Expression -> Elm.Expression) -> Elm.Expression + toBody : (Elm.Expression -> Elm.Expression -> Elm.Expression) -> Elm.Expression toBody f = - f mime (Elm.get "body" config) + f (Elm.string mime) (Elm.get "body" config) in - { core = toBody Gen.Http.bytesBody - , elmPages = toBody Gen.BackendTask.Http.bytesBody - , lamderaProgramTest = toBody Gen.Effect.Http.bytesBody + { core = toBody Gen.Http.call_.bytesBody + , elmPages = toBody Gen.BackendTask.Http.call_.bytesBody + , lamderaProgramTest = toBody Gen.Effect.Http.call_.bytesBody } Base64Content mime ->