Skip to content

[BUG] List<Enum> response generates invalid Elm code #22530

Open

Description

@bjornpijnacker

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master latest stable to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When an endpoint returns an array of enum values the generate Elm code is incomplete and invalid.

Running the generator on the example file, the following is generated:

module Api.Request.SomethingController exposing
    ( somethingControllerGet
    )

import Api
import Api.Data exposing (..)
import Dict
import Http
import Json.Decode
import Json.Encode


somethingControllerGet : Api.Request (List String)
somethingControllerGet =
    Api.request
        "GET"
        "/api/something"
        []
        []
        []
        Nothing
        (Json.Decode.list somethingControllerResponseDecoder)

Multiple issues here:

  • The generated function return a List String. This should be a List Enum where Enum is the type specified in the spec.
  • There is no Api.Data generated.
  • The somethingControllerResponseDecoder does not exist.

The generator should either fail, fall back to String properly, or should generate the correct code. The generator should not produce code that will not compile in any case.

openapi-generator version

7.17.0

OpenAPI declaration file content or url

https://gist.github.com/bjornpijnacker/c66e6447404f91f0baa7f785aceba4ae

Generation Details

openapi-generator generate -i openapi.json -g elm -o output

Steps to reproduce

N/A

Activity

  1. miniBill commented on Jan 30, 2026

    @miniBill

    I would recommend trying https://github.com/wolfadex/elm-open-api-cli/ instead

  2. bjornpijnacker commented on Feb 12, 2026

    @bjornpijnacker
    Author

    @miniBill

    I would recommend trying https://github.com/wolfadex/elm-open-api-cli/ instead

    This does not work for our use-case since it doesn't support file uploads using multipart/form-data. This package does.

  3. miniBill commented on Apr 1, 2026

    @miniBill

    Will be fixed in wolfadex/elm-open-api-cli#289

    EDIT: Which is now merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions