Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2484
Closed
Open
Issue created Mar 22, 2019 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG] [Elm] Uuid import and encoding missing

Created by: andys8

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

If a path variable is of type Uuid, the import and the encoding is missing.

Output (without comment):
module Request.UserController exposing (get)

import Data.User as User exposing (User)
import Dict
import Http
import Json.Decode as Decode
import Url.Builder as Url


get :
    { onSend : Result Http.Error User -> msg
    , basePath : String
    , userId : Uuid
    }
    -> Cmd msg
get params =
    Http.request
        { method = "GET"
        , headers = []
        , url =
            Url.crossOrigin params.basePath
                [ "users", params.userId ]
                []
        , body = Http.emptyBody
        , expect = Http.expectJson params.onSend User.decoder
        , timeout = Just 30000
        , tracker = Nothing
        }
openapi-generator version

v4.0.0-beta2

OpenAPI declaration file content or url
    "/users/{userId}": {
      "get": {
        "tags": ["user-controller"],
        "summary": "get",
        "operationId": "get",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "description": "userId",
            "required": true,
            "type": "string",
            "format": "uuid"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": { "$ref": "#/definitions/User" }
          },
          "401": { "description": "Unauthorized" },
          "403": { "description": "Forbidden" },
          "404": { "description": "Not Found" }
        },
        "deprecated": false
      }
    }
Command line used for generation
docker run --rm -v /server-sdk:/local openapitools/openapi-generator-cli:v4.0.0-beta2 generate -i /local/swagger.json -o /local/sdk/elm -g elm --invoker-package abc --additional-properties elmEnableCustomBasePaths=true
Steps to reproduce

Build and look into output in Request files.

Related issues/PRs

This PR introduced UUIDs. https://github.com/OpenAPITools/openapi-generator/pull/1516

Suggest a fix
  • add import
  • uuid to string with prm

This is what the output should look like (without comment)

module Request.UserController exposing (get)

-- CHANGED: Uuid import added manually

import Data.User as User exposing (User)
import Dict
import Http
import Json.Decode as Decode
import Url.Builder as Url
import Uuid exposing (Uuid)


get :
    { onSend : Result Http.Error User -> msg
    , basePath : String
    , userId : Uuid
    }
    -> Cmd msg
get params =
    Http.request
        { method = "GET"
        , headers = []
        , url =
            Url.crossOrigin params.basePath
                [ "users"
                , -- CHANGED: UUID.toString added manually
                  Uuid.toString params.userId
                ]
                []
        , body = Http.emptyBody
        , expect = Http.expectJson params.onSend User.decoder
        , timeout = Just 30000
        , tracker = Nothing
        }
Assignee
Assign to
Time tracking