-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8067612
commit b245242
Showing
16 changed files
with
126 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
modules/swagger-codegen/src/main/resources/dart/class.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@Entity() | ||
class {{classname}} { | ||
{{#vars}}{{#description}}/* {{{description}}} */{{/description}} | ||
@Property(name: '{{baseName}}') | ||
{{{datatype}}} {{name}} = {{{defaultValue}}}; | ||
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}} | ||
{{/vars}} | ||
{{classname}}(); | ||
|
||
@override | ||
String toString() { | ||
return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]'; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
modules/swagger-codegen/src/main/resources/dart/enum.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@Entity() | ||
enum {{classname}} { | ||
{{#allowableValues}}{{#enumVars}}{{name}}{{^-last}},{{/-last}} | ||
{{/enumVars}}{{/allowableValues}} | ||
} | ||
|
||
class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> { | ||
@override | ||
dynamic encode({{classname}} data) { | ||
switch(data) { | ||
{{#allowableValues}}{{#enumVars}}case {{classname}}.{{name}}: return {{value}}; | ||
{{/enumVars}}{{/allowableValues}} | ||
default: throw('Unknown enum value to encode: $data'); | ||
} | ||
} | ||
|
||
@override | ||
{{classname}} decode(dynamic data) { | ||
switch (data) { | ||
{{#allowableValues}}{{#enumVars}}case {{value}}: return {{classname}}.{{name}}; | ||
{{/enumVars}}{{/allowableValues}} | ||
default: throw('Unknown enum value to decode: $data'); | ||
} | ||
} | ||
} |
22 changes: 5 additions & 17 deletions
22
modules/swagger-codegen/src/main/resources/dart/model.mustache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,7 @@ | ||
part of {{pubName}}.api; | ||
|
||
{{#models}}{{#model}} | ||
@Entity() | ||
class {{classname}} { | ||
{{#vars}}{{#description}}/* {{{description}}} */{{/description}} | ||
@Property(name: '{{baseName}}') | ||
{{{datatype}}} {{name}} = {{{defaultValue}}}; | ||
{{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}} | ||
{{/vars}} | ||
{{classname}}(); | ||
|
||
@override | ||
String toString() { | ||
return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]'; | ||
} | ||
|
||
} | ||
{{/model}}{{/models}} | ||
{{#models}} | ||
{{#model}} | ||
{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} | ||
{{/model}} | ||
{{/models}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.2.3-SNAPSHOT | ||
2.3.0-SNAPSHOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters