diff --git a/swagger_parser/lib/src/generator/templates/dart_dart_mappable_dto_template.dart b/swagger_parser/lib/src/generator/templates/dart_dart_mappable_dto_template.dart index 1eb69c07c..5af797699 100644 --- a/swagger_parser/lib/src/generator/templates/dart_dart_mappable_dto_template.dart +++ b/swagger_parser/lib/src/generator/templates/dart_dart_mappable_dto_template.dart @@ -183,7 +183,7 @@ String _fieldsToString( ); return sortedByRequired .mapIndexed( - (i, e) => + (i, e) => '${descriptionComment(e.description, tab: ' ')}' '${_jsonKey(e)}${indentation(2)}final ${_renameUnionTypes(e.toSuitableType(ProgrammingLanguage.dart, useMultipartFile: useMultipartFile))} ${e.name};', ) .join('\n'); diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/cat.dart index c46d71a71..6711bc768 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/cat.dart @@ -15,6 +15,8 @@ class Cat with CatMappable { required this.mewCount, }); final CatType type; + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/dog.dart index 205b1328e..576eebb3c 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/dog.dart @@ -15,6 +15,8 @@ class Dog with DogMappable { required this.barkSound, }); final DogType type; + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/human.dart b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/human.dart index 0f86adc3a..88bbc7e3e 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/human.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_any_of_complete_mapping_mappable/expected_files/models/human.dart @@ -15,6 +15,8 @@ class Human with HumanMappable { required this.job, }); final HumanType type; + + /// The job of the human. final String job; static Human fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/cat.dart index c46d71a71..6711bc768 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/cat.dart @@ -15,6 +15,8 @@ class Cat with CatMappable { required this.mewCount, }); final CatType type; + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/dog.dart index 205b1328e..576eebb3c 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/dog.dart @@ -15,6 +15,8 @@ class Dog with DogMappable { required this.barkSound, }); final DogType type; + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/human.dart b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/human.dart index 0f86adc3a..88bbc7e3e 100644 --- a/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/human.dart +++ b/swagger_parser/test/e2e/tests/xof/discriminated_one_of.3.0_mappable/expected_files/models/human.dart @@ -15,6 +15,8 @@ class Human with HumanMappable { required this.job, }); final HumanType type; + + /// The job of the human. final String job; static Human fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/cat.dart index c46d71a71..6711bc768 100644 --- a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/cat.dart @@ -15,6 +15,8 @@ class Cat with CatMappable { required this.mewCount, }); final CatType type; + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/dog.dart index 205b1328e..576eebb3c 100644 --- a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/dog.dart @@ -15,6 +15,8 @@ class Dog with DogMappable { required this.barkSound, }); final DogType type; + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/human.dart b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/human.dart index 0f86adc3a..88bbc7e3e 100644 --- a/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/human.dart +++ b/swagger_parser/test/e2e/tests/xof/fallback_union_mappable/expected_files/models/human.dart @@ -15,6 +15,8 @@ class Human with HumanMappable { required this.job, }); final HumanType type; + + /// The job of the human. final String job; static Human fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/cat.dart index 7f62a7dd6..b5b93df27 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/cat.dart @@ -11,6 +11,8 @@ class Cat with CatMappable { const Cat({ required this.mewCount, }); + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/dog.dart index e32ae3a4f..5ad5f83e3 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/dog.dart @@ -11,6 +11,8 @@ class Dog with DogMappable { const Dog({ required this.barkSound, }); + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/human.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/human.dart index 4855d8614..0ccea0256 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/human.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_any_of_deferred_mappable/expected_files/models/human.dart @@ -11,6 +11,8 @@ class Human with HumanMappable { const Human({ required this.job, }); + + /// The job of the human. final String job; static Human fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/cat.dart index 7f62a7dd6..b5b93df27 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/cat.dart @@ -11,6 +11,8 @@ class Cat with CatMappable { const Cat({ required this.mewCount, }); + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/dog.dart index e32ae3a4f..5ad5f83e3 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/dog.dart @@ -11,6 +11,8 @@ class Dog with DogMappable { const Dog({ required this.barkSound, }); + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/human.dart b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/human.dart index 4855d8614..0ccea0256 100644 --- a/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/human.dart +++ b/swagger_parser/test/e2e/tests/xof/non_discriminated_one_of_deferred_mappable/expected_files/models/human.dart @@ -11,6 +11,8 @@ class Human with HumanMappable { const Human({ required this.job, }); + + /// The job of the human. final String job; static Human fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/cat.dart index 7f62a7dd6..b5b93df27 100644 --- a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/cat.dart @@ -11,6 +11,8 @@ class Cat with CatMappable { const Cat({ required this.mewCount, }); + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/dog.dart index e32ae3a4f..5ad5f83e3 100644 --- a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_any_of_deferred_mappable/expected_files/models/dog.dart @@ -11,6 +11,8 @@ class Dog with DogMappable { const Dog({ required this.barkSound, }); + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/cat.dart b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/cat.dart index 7f62a7dd6..b5b93df27 100644 --- a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/cat.dart +++ b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/cat.dart @@ -11,6 +11,8 @@ class Cat with CatMappable { const Cat({ required this.mewCount, }); + + /// Number of times the cat meows. final int mewCount; static Cat fromJson(Map json) => diff --git a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/dog.dart b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/dog.dart index e32ae3a4f..5ad5f83e3 100644 --- a/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/dog.dart +++ b/swagger_parser/test/e2e/tests/xof/union_inline_and_refs_one_of_deferred_mappable/expected_files/models/dog.dart @@ -11,6 +11,8 @@ class Dog with DogMappable { const Dog({ required this.barkSound, }); + + /// The sound of the dog's bark. final String barkSound; static Dog fromJson(Map json) =>