-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
Labels
Description
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 masterlatest 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 aList Enumwhere Enum is the type specified in the spec. - There is no
Api.Datagenerated. - The
somethingControllerResponseDecoderdoes 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