Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[elm] Add support for nested Lists & Dicts #1528

Merged
merged 1 commit into from
Nov 23, 2018

Conversation

eriktim
Copy link
Contributor

@eriktim eriktim commented Nov 22, 2018

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

Add support for nested Lists & Dicts, like List (List String).
And rename Union Types to Custom Types and Aliases to Records.

Fixes #1378. cc @wing328

@wing328
Copy link
Member

wing328 commented Nov 23, 2018

Looks like the code/template is still referring to union.mustache, which has been renamed:

[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator-test-fake-petstore/2.0/elm/src/Data/Dog.elm
[main] INFO  o.o.codegen.AbstractGenerator - writing file /tmp/openapi-generator-test-fake-petstore/2.0/elm/src/Data/EnumArrays.elm
[main] ERROR o.o.codegen.AbstractGenerator - elm/union.mustache (No such file or directory)
[main] ERROR o.o.codegen.AbstractGenerator - elm/union.mustache (No such file or directory)
Exception in thread "main" java.lang.RuntimeException: Could not generate model 'EnumClass'
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:474)
	at org.openapitools.codegen.DefaultGenerator.generate(DefaultGenerator.java:865)
	at org.openapitools.codegen.cmd.Generate.run(Generate.java:349)
	at org.openapitools.codegen.OpenAPIGenerator.main(OpenAPIGenerator.java:62)
Caused by: java.lang.RuntimeException: can't load template elm/union.mustache
	at org.openapitools.codegen.AbstractGenerator.getTemplateReader(AbstractGenerator.java:81)
	at org.openapitools.codegen.DefaultGenerator$4.getTemplate(DefaultGenerator.java:889)
	at com.samskivert.mustache.Mustache$IncludedTemplateSegment.execute(Mustache.java:756)
	at com.samskivert.mustache.Template.executeSegs(Template.java:157)
	at com.samskivert.mustache.Mustache$IncludedTemplateSegment.execute(Mustache.java:774)
	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:870)
	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:881)
	at com.samskivert.mustache.Mustache$BlockSegment.executeSegs(Mustache.java:845)
	at com.samskivert.mustache.Mustache$SectionSegment.execute(Mustache.java:866)
	at com.samskivert.mustache.Template.executeSegs(Template.java:157)
	at com.samskivert.mustache.Template.execute(Template.java:134)
	at com.samskivert.mustache.Template.execute(Template.java:125)
	at org.openapitools.codegen.DefaultGenerator.processTemplateToFile(DefaultGenerator.java:895)
	at org.openapitools.codegen.DefaultGenerator.generateModel(DefaultGenerator.java:309)
	at org.openapitools.codegen.DefaultGenerator.generateModels(DefaultGenerator.java:463)
	... 3 more

To reproduce the issue (as reported by Shippable CI), please run

java -jar ./modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g elm -o /tmp/openapi-generator-test-fake-petstore/2.0/elm

@eriktim
Copy link
Contributor Author

eriktim commented Nov 23, 2018

Wow, how could I have missed that one. Committing a fix right now.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
And rename Union Types to Custom Types and Aliases to Records.
@eriktim eriktim merged commit e91d6d7 into OpenAPITools:master Nov 23, 2018
@eriktim eriktim deleted the elm-list-of-lists branch November 23, 2018 15:04
@wing328
Copy link
Member

wing328 commented Dec 4, 2018

@trenneman thanks for the PR, which has been included in the v3.3.4 release: https://twitter.com/oas_generator/status/1068772409795207168

A-Joshi pushed a commit to ihsmarkitoss/openapi-generator that referenced this pull request Feb 27, 2019
And rename Union Types to Custom Types and Aliases to Records.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants