question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] 5.0.0 beta3 (regression from beta2) produces invalid Elm code with doubled decoders/types for JSON arrays

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
wing328commented, Dec 17, 2020

I’ve file https://github.com/OpenAPITools/openapi-generator/pull/8223 to fix it. Can you please take a look as well?

0reactions
wing328commented, Jan 5, 2021

@SiriusStarr I’ve merged #8223. Please open a new issue instead. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What if the Regression Equation Contains "Wrong" Predictors?
The good thing is that a correctly specified regression model yields unbiased regression coefficients and unbiased predictions of the response.
Read more >
Incorrect output is returned when you use the Linear ...
Discusses a problem in which the incorrect output is returned when you use Linear Regression (LINEST) function in Excel.
Read more >
Multiple Linear Regression
Multiple Regression Analysis. The regression coefficient β1 is interpreted as the expected change in Y associated with a 1-unit increase in x1.
Read more >
Practical Regression and Anova using R
The emphasis of this text is on the practice of regression and analysis of variance. The objective is to learn what methods are...
Read more >
Linear Regression Tool | Alteryx Help
The Linear Regression Tool creates a simple model to estimate values, or evaluate relationships between variables based on a linear ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found