[BUG] 5.0.0 beta3 (regression from beta2) produces invalid Elm code with doubled decoders/types for JSON arrays
Created by: SiriusStarr
Json arrays are turned into invalid decoders/functions in beta3, where the record access of the decoder or type is doubled, producing invalid Elm code.
For example, everywhere that should have
Json.Decode.list Api.Data.widgetDecoder
instead has
Json.Decode.list Api.Data.widgetDecoder.Api.Data.widgetDecoder
This additionally occurs in the type annotations, e.g. what should be
findWidgets : List String -> Api.Requrest (List Api.Data.Widget)
will instead be
findWidgets : List String -> Api.Requrest (List Api.Data.Widget.Api.Data.Widget)
An example with the petstore is produced below (but this problem occurs in other APIs as well that I have tried).
To produce:
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta2/openapi-generator-cli-5.0.0-beta2.jar
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta3/openapi-generator-cli-5.0.0-beta3.jar
java -jar openapi-generator-cli-5.0.0-beta2.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g elm -o petstore-beta2
java -jar openapi-generator-cli-5.0.0-beta3.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g elm -o petstore-beta3
diff -r petstore-beta2 petstore-beta3
Diff output:
diff -r petstore-beta2/.openapi-generator/VERSION petstore-beta3/.openapi-generator/VERSION
1c1
< 5.0.0-beta2
\ No newline at end of file
---
> 5.0.0-beta3
\ No newline at end of file
diff -r petstore-beta2/src/Api/Request/Pet.elm petstore-beta3/src/Api/Request/Pet.elm
93c93
< findPetsByStatus : List Status -> Api.Request (List Api.Data.Pet)
---
> findPetsByStatus : List Status -> Api.Request (List Api.Data.Api.Data.Pet)
102c102
< (Json.Decode.list Api.Data.petDecoder)
---
> (Json.Decode.list Api.Data.petDecoderApi.Data.petDecoder)
108c108
< findPetsByTags : List String -> Api.Request (List Api.Data.Pet)
---
> findPetsByTags : List String -> Api.Request (List Api.Data.Api.Data.Pet)
117c117
< (Json.Decode.list Api.Data.petDecoder)
---
> (Json.Decode.list Api.Data.petDecoderApi.Data.petDecoder)