You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chameleon82
changed the title
[BUG][SCALA] instantiationType array is missed in Scala generators
[BUG][SCALA] instantiationType array is missed in Scalatra generator
Mar 3, 2020
Hm. This existed when I stepped through the code last. I wonder if I forgot to commit or if it came from DefaultCodegen and has since been removed. Or maybe it was only defined in a derived generator.
I imagine we'd have the same issue for all OpenAPI types which should not be Java types and really shouldn't rely on DefaultCodegen to "do the right thing" (like map should instantiate with immutable Map by default).
* [scala] Set support for unique arrays
This includes and builds upon community contribution for better Set support in Scala.
It makes property + model work as expected with Set and default values
across all Scala generators. Included tests to account for new changes.
This also reverts the community contribution to remove ListBuffer
imports and change the default for array to ListBuffer. Users should use
the instantiation types map to modify the desired array instantiation
type. Any new default should target a new minor release after community
discussion, as it affects all existing SDKs generated with
openapi-generator.
* [scala] Improve default handling of monadic collection type
* [scala] Regenerate samples
* Update ScalaPlayFrameworkServerCodegen.java
Scala Play defaulted to List and should continue to do so.
Co-authored-by: František Kocun <frantisek.kocun@gmail.com>
Bug Report Checklist
Scalatra server template generating wrong default value
new null[]()
instead of 'List[String].emptydue missed
array` instantiationTypeDescription
openapi-generator version
2.3.0-SNAPSHOT
OpenAPI declaration file content or url
https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml
Command line used for generation
Steps to reproduce
regenerate scalatra server - default value has incorrect value
new null[]()
. should beList[String].empty
Related issues/PRs
Related code 25036e4#diff-62e3a15550247bb6a76bdc7745faa850R265
Suggest a fix
Add
instantiationTypes.put("array", "List");
at abstract level or per template if array has specific meaning@jimschubert
The text was updated successfully, but these errors were encountered: