Skip to content

Commit

Permalink
Version/2.7.3 (#447)
Browse files Browse the repository at this point in the history
* Some fixes

* Removed not needed code

* fixed generation of putIfAbsent for responses which are models with properties

* Fixed tests

* Implemented copyWithWrapped generation

* Fixed issue with empty enum names

* Updated pubspec and changelog

* Fixed tests

Co-authored-by: uladzimir_paliukhovich <>
  • Loading branch information
Vovanella95 committed Aug 11, 2022
1 parent 5c0c9a0 commit da9ea15
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.7.3

* Fixed issue with generation `+` and `-` signs as enum names ([#444](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/444))

# 2.7.2

* Implemented generation of copyWithWrapped ([#438](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/438))
Expand Down
13 changes: 5 additions & 8 deletions lib/src/code_generators/swagger_enums_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,7 @@ $enumMap
}

result.add(validatedValue);

if (isInteger) {
resultStrings.add(
"\t@JsonValue(${value.replaceAll("\$", "\\\$")})\n\t$validatedValue");
} else {
resultStrings.add(
"\t@JsonValue('${value.replaceAll("\$", "\\\$")}')\n\t$validatedValue");
}
resultStrings.add(validatedValue);
}

return resultStrings.join(',\n');
Expand Down Expand Up @@ -290,6 +283,10 @@ $enumMap
return '\$' + result.lower;
}

if (result.isEmpty) {
return 'undefined';
}

return result.lower;
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: swagger_dart_code_generator

version: 2.7.2
version: 2.7.3

homepage: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator
repository: https://github.com/epam-cross-platform-lab/swagger-dart-code-generator
Expand Down
2 changes: 1 addition & 1 deletion test/generator_tests/enums_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void main() {
group('Converter generator tests', () {
test('Should generate enum values', () {
final values = <String>['file_sup'];
const output = "\t@JsonValue('file_sup')\n\tfileSup";
const output = "fileSup";
final result = generator.getEnumValuesContent(
enumValues: values,
isInteger: false,
Expand Down

0 comments on commit da9ea15

Please sign in to comment.