Skip to content

[Elm] Add missing operation summary #20147

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

Merged
merged 4 commits into from
Nov 22, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import Json.Decode
import Json.Encode{{#includeUuid}}
import Uuid exposing (Uuid){{/includeUuid}}{{#includeFile}}
import File exposing (File){{/includeFile}}

{{#operations}}
{{#operation}}
{{#allParams}}
{{#isEnum}}


{{>customType}}


Expand All @@ -28,12 +28,15 @@ import File exposing (File){{/includeFile}}
{{/operation}}
{{/operations}}
{{#operations}}
{{#operation}}

{{#operation}}{{#summary}}
{-| {{{summary}}}
{{#notes}}
{-| {{{notes}}}
-}

{{{notes}}}

{{/notes}}
-}{{/summary}}{{^summary}}{{#notes}}{-| {{{notes}}}
-}{{/notes}}{{/summary}}
{{#lambda.removeWhitespace}}
{{operationId}} : {{#allParams}}{{>operationParameter}} -> {{/allParams}}
{{#authMethods}}{{#isBasicBearer}}String -> {{/isBasicBearer}}{{/authMethods}}Api.Request
Expand Down
25 changes: 22 additions & 3 deletions samples/client/petstore/elm/src/Api/Request/Pet.elm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ stringFromStatus model =



{-| Add a new pet to the store
-}
addPet : Api.Data.Pet -> Api.Request Api.Data.Pet
addPet pet_body =
Api.request
Expand All @@ -73,6 +75,8 @@ addPet pet_body =
Api.Data.petDecoder


{-| Deletes a pet
-}
deletePet : Int -> Maybe String -> Api.Request ()
deletePet petId_path apiKey_header =
Api.request
Expand All @@ -85,7 +89,10 @@ deletePet petId_path apiKey_header =
(Json.Decode.succeed ())


{-| Multiple status values can be provided with comma separated strings
{-| Finds Pets by status

Multiple status values can be provided with comma separated strings

-}
findPetsByStatus : List Status -> Api.Request (List Api.Data.Pet)
findPetsByStatus status_query =
Expand All @@ -99,7 +106,10 @@ findPetsByStatus status_query =
(Json.Decode.list Api.Data.petDecoder)


{-| Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
{-| Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

-}
findPetsByTags : List String -> Api.Request (List Api.Data.Pet)
findPetsByTags tags_query =
Expand All @@ -113,7 +123,10 @@ findPetsByTags tags_query =
(Json.Decode.list Api.Data.petDecoder)


{-| Returns a single pet
{-| Find pet by ID

Returns a single pet

-}
getPetById : Int -> Api.Request Api.Data.Pet
getPetById petId_path =
Expand All @@ -127,6 +140,8 @@ getPetById petId_path =
Api.Data.petDecoder


{-| Update an existing pet
-}
updatePet : Api.Data.Pet -> Api.Request Api.Data.Pet
updatePet pet_body =
Api.request
Expand All @@ -139,6 +154,8 @@ updatePet pet_body =
Api.Data.petDecoder


{-| Updates a pet in the store with form data
-}
updatePetWithForm : Int -> Maybe String -> Maybe String -> Api.Request ()
updatePetWithForm petId_path name status =
Api.request
Expand All @@ -151,6 +168,8 @@ updatePetWithForm petId_path name status =
(Json.Decode.succeed ())


{-| uploads an image
-}
uploadFile : Int -> Maybe String -> Maybe File -> Api.Request Api.Data.ApiResponse
uploadFile petId_path additionalMetadata file =
Api.request
Expand Down
18 changes: 15 additions & 3 deletions samples/client/petstore/elm/src/Api/Request/Store.elm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import Http
import Json.Decode
import Json.Encode

{-| For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

{-| Delete purchase order by ID

For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors

-}
deleteOrder : String -> Api.Request ()
deleteOrder orderId_path =
Expand All @@ -41,7 +45,10 @@ deleteOrder orderId_path =
(Json.Decode.succeed ())


{-| Returns a map of status codes to quantities
{-| Returns pet inventories by status

Returns a map of status codes to quantities

-}
getInventory : Api.Request (Dict.Dict String Int)
getInventory =
Expand All @@ -55,7 +62,10 @@ getInventory =
(Json.Decode.dict Json.Decode.int)


{-| For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions
{-| Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions

-}
getOrderById : Int -> Api.Request Api.Data.Order_
getOrderById orderId_path =
Expand All @@ -69,6 +79,8 @@ getOrderById orderId_path =
Api.Data.orderDecoder


{-| Place an order for a pet
-}
placeOrder : Api.Data.Order_ -> Api.Request Api.Data.Order_
placeOrder order_body =
Api.request
Expand Down
26 changes: 23 additions & 3 deletions samples/client/petstore/elm/src/Api/Request/User.elm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ import Http
import Json.Decode
import Json.Encode

{-| This can only be done by the logged in user.

{-| Create user

This can only be done by the logged in user.

-}
createUser : Api.Data.User -> Api.Request ()
createUser user_body =
Expand All @@ -45,6 +49,8 @@ createUser user_body =
(Json.Decode.succeed ())


{-| Creates list of users with given input array
-}
createUsersWithArrayInput : List Api.Data.User -> Api.Request ()
createUsersWithArrayInput user_body =
Api.request
Expand All @@ -57,6 +63,8 @@ createUsersWithArrayInput user_body =
(Json.Decode.succeed ())


{-| Creates list of users with given input array
-}
createUsersWithListInput : List Api.Data.User -> Api.Request ()
createUsersWithListInput user_body =
Api.request
Expand All @@ -69,7 +77,10 @@ createUsersWithListInput user_body =
(Json.Decode.succeed ())


{-| This can only be done by the logged in user.
{-| Delete user

This can only be done by the logged in user.

-}
deleteUser : String -> Api.Request ()
deleteUser username_path =
Expand All @@ -83,6 +94,8 @@ deleteUser username_path =
(Json.Decode.succeed ())


{-| Get user by user name
-}
getUserByName : String -> Api.Request Api.Data.User
getUserByName username_path =
Api.request
Expand All @@ -95,6 +108,8 @@ getUserByName username_path =
Api.Data.userDecoder


{-| Logs user into the system
-}
loginUser : String -> String -> Api.Request String
loginUser username_query password_query =
Api.request
Expand All @@ -107,6 +122,8 @@ loginUser username_query password_query =
Json.Decode.string


{-| Logs out current logged in user session
-}
logoutUser : Api.Request ()
logoutUser =
Api.request
Expand All @@ -119,7 +136,10 @@ logoutUser =
(Json.Decode.succeed ())


{-| This can only be done by the logged in user.
{-| Updated user

This can only be done by the logged in user.

-}
updateUser : String -> Api.Data.User -> Api.Request ()
updateUser username_path user_body =
Expand Down
4 changes: 2 additions & 2 deletions samples/openapi3/client/elm/src/Api/Request/Default.elm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ stringFromHeaderType model =




type Enumeration
= EnumerationA
| EnumerationB
Expand Down Expand Up @@ -83,7 +82,6 @@ stringFromEnumeration model =




type Enum
= EnumA
| EnumB
Expand Down Expand Up @@ -160,6 +158,8 @@ queryGet string_query int_query enum_query =
(Json.Decode.succeed ())


{-| Secured endpoint
-}
securedPost : String -> Api.Request ()
securedPost auth_token =
Api.request
Expand Down
1 change: 1 addition & 0 deletions samples/openapi3/client/elm/src/Api/Request/Primitive.elm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import Http
import Json.Decode
import Json.Encode


update : Api.Data.Primitive -> Api.Request Api.Data.Primitive
update primitive_body =
Api.request
Expand Down
Loading