Skip to content

Commit

Permalink
goosed up the array handling and central half-baked the release
Browse files Browse the repository at this point in the history
  • Loading branch information
rvowles committed Oct 15, 2023
1 parent 317eb8e commit 4e5f5ee
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<artifactId>openapi-dart-generator</artifactId>
<packaging>jar</packaging>
<name>openapi-dart-generator</name>
<version>8.1-RC3-SNAPSHOT</version>
<version>8.1-RC4-SNAPSHOT</version>

<description>
dart2 generator from openapi 3.x spec files.
Expand Down
23 changes: 15 additions & 8 deletions src/main/resources/dart2-v3template/class.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class {{{classname}}}{{#parent}} extends {{parent}}{{/parent}} {
{{^isNullable}}late {{/isNullable}}dynamic json;
{{/parent}}{{/hasVars}}
{{#vars}}
// {{name}} required: {{required}} nullable: {{isNullable}} default: {{vendorExtensions.original-default}} inherited: {{isInherited}}
// {{name}} required: {{required}} nullable: {{isNullable}} default: {{vendorExtensions.original-default}} inherited: {{isInherited}} container {{isContainer}}
{{/vars}}
{{{classname}}}(
{{#hasVars}}{
Expand All @@ -38,13 +38,20 @@ class {{{classname}}}{{#parent}} extends {{parent}}{{/parent}} {
this.{{{name}}}{{^required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{/required}}
{{/vendorExtensions.required-owned}}
{{^vendorExtensions.required-owned}}
{{#isArray}}{{{dataType}}}{{^isNullable}}{{^isInherited}}?{{/isInherited}}{{/isNullable}} {{{name}}}{{/isArray}}
{{#isMap}}{{{dataType}}}{{^isNullable}}{{^isInherited}}?{{/isInherited}}{{/isNullable}} {{{name}}}{{/isMap}}
{{^isArray}}
{{^isMap}}
{{#isInherited}}{{{dataType}}} {{/isInherited}}{{^isInherited}}this.{{/isInherited}}{{{name}}}{{^required}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}{{/required}}
{{/isMap}}
{{/isArray}}
{{! now we just deal with arrays and maps }}
{{#isContainer}}
{{#isInherited}}{{{dataType}}} {{{name}}}{{/isInherited}}
{{^isInherited}}
{{#defaultValue}}{{{dataType}}}{{^isNullable}}?{{/isNullable}} {{{name}}}{{/defaultValue}}
{{^defaultValue}}this.{{{name}}}{{/defaultValue}}
{{/isInherited}}
{{/isContainer}}
{{^isContainer}}
{{#isInherited}}{{{dataType}}} {{{name}}}{{/isInherited}}
{{^isInherited}}
this.{{{name}}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}}
{{/isInherited}}
{{/isContainer}}
{{/vendorExtensions.required-owned}}
{{^-last}}, {{/-last}}
{{/vars}} }{{/hasVars}}
Expand Down

0 comments on commit 4e5f5ee

Please sign in to comment.