Skip to content

Commit

Permalink
Merge branch 'master' into development
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
#	lib/src/code_generators/swagger_additions_generator.dart
#	lib/src/code_generators/swagger_models_generator.dart
#	lib/src/models/generator_options.dart
#	lib/src/models/generator_options.g2.dart
#	pubspec.yaml
  • Loading branch information
Uladzimir Paliukhovich committed Nov 1, 2023
2 parents c8c3522 + 59df331 commit d7a06b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# 2.11.13

# 2.12.1
* Fixed return type nullability ([#670](https://github.com/epam-cross-platform-lab/swagger-dart-code-generator/issues/670))
* Fixed generation of DateTime return types

# 2.12.1
# 2.11.13

* Fixed different issues

Expand Down
5 changes: 5 additions & 0 deletions lib/src/code_generators/swagger_models_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ abstract class SwaggerModelsGenerator extends SwaggerGeneratorBase {
typeName = typeName.makeNullable();
}

if (requiredProperties.isNotEmpty &&
!requiredProperties.contains(propertyKey)) {
typeName = typeName.makeNullable();
}

final jsonKeyContent =
"@JsonKey(name: '$propertyKey'$includeIfNullString$dateToJsonValue${unknownEnumValue.jsonKey})\n";
return '\t$jsonKeyContent\tfinal $typeName ${generateFieldName(propertyName)};${unknownEnumValue.fromJson}';
Expand Down

0 comments on commit d7a06b2

Please sign in to comment.