diff --git a/example/lib/custom_model_directory/article/custom_base_directory_obj.dart b/example/lib/custom_model_directory/article/custom_base_directory_obj.dart index 2dab8ff..c2df5c0 100644 --- a/example/lib/custom_model_directory/article/custom_base_directory_obj.dart +++ b/example/lib/custom_model_directory/article/custom_base_directory_obj.dart @@ -15,8 +15,7 @@ class CustomBaseDirectoryObj { this.name, }); - factory CustomBaseDirectoryObj.fromJson(Map json) => - _$CustomBaseDirectoryObjFromJson(json); + factory CustomBaseDirectoryObj.fromJson(Map json) => _$CustomBaseDirectoryObjFromJson(json); Map toJson() => _$CustomBaseDirectoryObjToJson(this); @@ -28,24 +27,23 @@ class CustomBaseDirectoryObj { name == other.name; @override - int get hashCode => name.hashCode; + int get hashCode => + name.hashCode; @override - String toString() => 'CustomBaseDirectoryObj{' + String toString() => + 'CustomBaseDirectoryObj{' 'name: $name' '}'; + } const deserializeCustomBaseDirectoryObj = CustomBaseDirectoryObj.fromJson; -Map serializeCustomBaseDirectoryObj( - CustomBaseDirectoryObj object) => - object.toJson(); +Map serializeCustomBaseDirectoryObj(CustomBaseDirectoryObj object) => object.toJson(); -List deserializeCustomBaseDirectoryObjList( - List> jsonList) => - jsonList.map(CustomBaseDirectoryObj.fromJson).toList(); +List deserializeCustomBaseDirectoryObjList(List> jsonList) + => jsonList.map(CustomBaseDirectoryObj.fromJson).toList(); -List> serializeCustomBaseDirectoryObjList( - List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeCustomBaseDirectoryObjList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/article/no_custom_base_directory_obj.dart b/example/lib/model/article/no_custom_base_directory_obj.dart index 306bd77..0a2df06 100644 --- a/example/lib/model/article/no_custom_base_directory_obj.dart +++ b/example/lib/model/article/no_custom_base_directory_obj.dart @@ -16,8 +16,7 @@ class NoCustomBaseDirectoryObj { this.customBaseDirectoryObj, }); - factory NoCustomBaseDirectoryObj.fromJson(Map json) => - _$NoCustomBaseDirectoryObjFromJson(json); + factory NoCustomBaseDirectoryObj.fromJson(Map json) => _$NoCustomBaseDirectoryObjFromJson(json); Map toJson() => _$NoCustomBaseDirectoryObjToJson(this); @@ -29,24 +28,23 @@ class NoCustomBaseDirectoryObj { customBaseDirectoryObj == other.customBaseDirectoryObj; @override - int get hashCode => customBaseDirectoryObj.hashCode; + int get hashCode => + customBaseDirectoryObj.hashCode; @override - String toString() => 'NoCustomBaseDirectoryObj{' + String toString() => + 'NoCustomBaseDirectoryObj{' 'customBaseDirectoryObj: $customBaseDirectoryObj' '}'; + } const deserializeNoCustomBaseDirectoryObj = NoCustomBaseDirectoryObj.fromJson; -Map serializeNoCustomBaseDirectoryObj( - NoCustomBaseDirectoryObj object) => - object.toJson(); +Map serializeNoCustomBaseDirectoryObj(NoCustomBaseDirectoryObj object) => object.toJson(); -List deserializeNoCustomBaseDirectoryObjList( - List> jsonList) => - jsonList.map(NoCustomBaseDirectoryObj.fromJson).toList(); +List deserializeNoCustomBaseDirectoryObjList(List> jsonList) + => jsonList.map(NoCustomBaseDirectoryObj.fromJson).toList(); -List> serializeNoCustomBaseDirectoryObjList( - List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeNoCustomBaseDirectoryObjList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/ogm.dart b/example/lib/model/ogm.dart index 149f048..478d298 100644 --- a/example/lib/model/ogm.dart +++ b/example/lib/model/ogm.dart @@ -92,7 +92,8 @@ class OGM { simpleMap.hashCode; @override - String toString() => 'OGM{' + String toString() => + 'OGM{' 'beneficiary: $beneficiary, ' 'beneficiaryIBAN: $beneficiaryIBAN, ' 'testTest: $testTest, ' @@ -107,14 +108,15 @@ class OGM { 'fields: $fields, ' 'simpleMap: $simpleMap' '}'; + } const deserializeOGM = OGM.fromJson; Map serializeOGM(OGM object) => object.toJson(); -List deserializeOGMList(List> jsonList) => - jsonList.map(OGM.fromJson).toList(); +List deserializeOGMList(List> jsonList) + => jsonList.map(OGM.fromJson).toList(); -List> serializeOGMList(List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeOGMList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/status/double_status.dart b/example/lib/model/status/double_status.dart index f888ab3..7e31ce2 100644 --- a/example/lib/model/status/double_status.dart +++ b/example/lib/model/status/double_status.dart @@ -3,34 +3,26 @@ import 'package:json_annotation/json_annotation.dart'; enum DoubleStatus { - @JsonValue(0.0) - STATUS_0, - @JsonValue(1.0) - STATUS_1, - @JsonValue(2.0) - STATUS_2, - @JsonValue(3.0) - STATUS_3, -} - -const doubleStatusMapping = { - DoubleStatus.STATUS_0: 0.0, - DoubleStatus.STATUS_1: 1.0, - DoubleStatus.STATUS_2: 2.0, - DoubleStatus.STATUS_3: 3.0, -}; + @JsonValue(0.1) + STATUS_0( + value: 0.1, + ), + @JsonValue(1.1) + STATUS_1( + value: 1.1, + ), + @JsonValue(2.2) + STATUS_2( + value: 2.2, + ), + @JsonValue(3.3) + STATUS_3( + value: 3.3, + ); -final reverseDoubleStatusMapping = { - 0.0: DoubleStatus.STATUS_0, - 1.0: DoubleStatus.STATUS_1, - 2.0: DoubleStatus.STATUS_2, - 3.0: DoubleStatus.STATUS_3, -}; - -extension DoubleStatusExtension on DoubleStatus { - double get doubleValue => doubleStatusMapping[this]!; -} + final double value; -extension DoubleStatusDoubleExtension on double { - DoubleStatus? get asDoubleStatus => reverseDoubleStatusMapping[this]; + const DoubleStatus({ + required this.value, + }); } diff --git a/example/lib/model/status/status.dart b/example/lib/model/status/status.dart index a0d45ff..0fc4231 100644 --- a/example/lib/model/status/status.dart +++ b/example/lib/model/status/status.dart @@ -4,33 +4,25 @@ import 'package:json_annotation/json_annotation.dart'; enum Status { @JsonValue(0) - STATUS_0, + STATUS_0( + value: 0, + ), @JsonValue(1) - STATUS_1, + STATUS_1( + value: 1, + ), @JsonValue(2) - STATUS_2, + STATUS_2( + value: 2, + ), @JsonValue(3) - STATUS_3, -} - -const statusMapping = { - Status.STATUS_0: 0, - Status.STATUS_1: 1, - Status.STATUS_2: 2, - Status.STATUS_3: 3, -}; + STATUS_3( + value: 3, + ); -const reverseStatusMapping = { - 0: Status.STATUS_0, - 1: Status.STATUS_1, - 2: Status.STATUS_2, - 3: Status.STATUS_3, -}; - -extension StatusExtension on Status { - int get intValue => statusMapping[this]!; -} + final int value; -extension StatusIntExtension on int { - Status? get asStatus => reverseStatusMapping[this]; + const Status({ + required this.value, + }); } diff --git a/example/lib/model/user/person/gender.dart b/example/lib/model/user/person/gender.dart index a82ca2d..8019bc4 100644 --- a/example/lib/model/user/person/gender.dart +++ b/example/lib/model/user/person/gender.dart @@ -4,25 +4,45 @@ import 'package:json_annotation/json_annotation.dart'; enum Gender { @JsonValue('_mAl3') - MALE(name: 'brian'), + MALE( + value: '_mAl3', + ), @JsonValue('femAle') - FEMALE(name: 'brian'), + FEMALE( + value: 'femAle', + ), @JsonValue('X') - X(name: 'brian'), - @JsonValue('GENDER_X') - GENDER_X(name: 'brian'), - @JsonValue('null') - GENDER_Y(name: 'brian'), + X( + value: 'X', + ), + @JsonValue('gender_x') + GENDER_X( + value: 'gender_x', + ), + @JsonValue('gender_y') + GENDER_Y( + value: 'gender_y', + ), @JsonValue('gender_z') - GENDER_Z(name: 'brian'), - @JsonValue('GENDER_abC') - GENDER_ABC(name: 'brian'), - @JsonValue('null') - GENDER_DEF(name: 'brian'), + GENDER_Z( + value: 'gender_z', + ), + @JsonValue('gender_abc') + GENDER_ABC( + value: 'gender_abc', + ), + @JsonValue('gender_def') + GENDER_DEF( + value: 'gender_def', + ), @JsonValue('GENDER_lap') - GENDER_LAP(name: 'brian'); + GENDER_LAP( + value: 'GENDER_lap', + ); - final String name; + final String value; - const Gender({required this.name}); + const Gender({ + required this.value, + }); } diff --git a/example/lib/model/user/person/person.dart b/example/lib/model/user/person/person.dart index 1606912..1a1b74c 100644 --- a/example/lib/model/user/person/person.dart +++ b/example/lib/model/user/person/person.dart @@ -11,11 +11,7 @@ part 'person.g.dart'; class Person { @JsonKey(name: 'firstName', required: true, includeIfNull: false) final String firstName; - @JsonKey( - name: 'gender', - required: true, - includeIfNull: false, - unknownEnumValue: Gender.X) + @JsonKey(name: 'gender', required: true, includeIfNull: false, unknownEnumValue: Gender.X) final Gender gender; const Person({ @@ -36,21 +32,25 @@ class Person { gender == other.gender; @override - int get hashCode => firstName.hashCode ^ gender.hashCode; + int get hashCode => + firstName.hashCode ^ + gender.hashCode; @override - String toString() => 'Person{' + String toString() => + 'Person{' 'firstName: $firstName, ' 'gender: $gender' '}'; + } const deserializePerson = Person.fromJson; Map serializePerson(Person object) => object.toJson(); -List deserializePersonList(List> jsonList) => - jsonList.map(Person.fromJson).toList(); +List deserializePersonList(List> jsonList) + => jsonList.map(Person.fromJson).toList(); -List> serializePersonList(List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializePersonList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/user/person/person.g.dart b/example/lib/model/user/person/person.g.dart index 970221b..5b0b759 100644 --- a/example/lib/model/user/person/person.g.dart +++ b/example/lib/model/user/person/person.g.dart @@ -27,10 +27,10 @@ const _$GenderEnumMap = { Gender.MALE: '_mAl3', Gender.FEMALE: 'femAle', Gender.X: 'X', - Gender.GENDER_X: 'GENDER_X', - Gender.GENDER_Y: 'null', + Gender.GENDER_X: 'gender_x', + Gender.GENDER_Y: 'gender_y', Gender.GENDER_Z: 'gender_z', - Gender.GENDER_ABC: 'GENDER_abC', - Gender.GENDER_DEF: 'null', + Gender.GENDER_ABC: 'gender_abc', + Gender.GENDER_DEF: 'gender_def', Gender.GENDER_LAP: 'GENDER_lap', }; diff --git a/example/lib/model/user/profile/admin_profile_data.dart b/example/lib/model/user/profile/admin_profile_data.dart index ac5a8af..d1c3047 100644 --- a/example/lib/model/user/profile/admin_profile_data.dart +++ b/example/lib/model/user/profile/admin_profile_data.dart @@ -44,8 +44,7 @@ class AdminProfileData extends UserProfileDataExtended { personsById: personsById, ); - factory AdminProfileData.fromJson(Map json) => - _$AdminProfileDataFromJson(json); + factory AdminProfileData.fromJson(Map json) => _$AdminProfileDataFromJson(json); @override Map toJson() => _$AdminProfileDataToJson(this); @@ -59,10 +58,13 @@ class AdminProfileData extends UserProfileDataExtended { super == other; @override - int get hashCode => privileges.hashCode ^ super.hashCode; + int get hashCode => + privileges.hashCode ^ + super.hashCode; @override - String toString() => 'AdminProfileData{' + String toString() => + 'AdminProfileData{' 'privileges: $privileges, ' 'additionalField: $additionalField, ' 'firstName: $firstName, ' @@ -77,17 +79,15 @@ class AdminProfileData extends UserProfileDataExtended { 'persons: $persons, ' 'personsById: $personsById' '}'; + } const deserializeAdminProfileData = AdminProfileData.fromJson; -Map serializeAdminProfileData(AdminProfileData object) => - object.toJson(); +Map serializeAdminProfileData(AdminProfileData object) => object.toJson(); -List deserializeAdminProfileDataList( - List> jsonList) => - jsonList.map(AdminProfileData.fromJson).toList(); +List deserializeAdminProfileDataList(List> jsonList) + => jsonList.map(AdminProfileData.fromJson).toList(); -List> serializeAdminProfileDataList( - List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeAdminProfileDataList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/user/profile/user_profile_data.dart b/example/lib/model/user/profile/user_profile_data.dart index 84b9c2d..7716bb7 100644 --- a/example/lib/model/user/profile/user_profile_data.dart +++ b/example/lib/model/user/profile/user_profile_data.dart @@ -48,8 +48,7 @@ class UserProfileData { this.personsById, }); - factory UserProfileData.fromJson(Map json) => - _$UserProfileDataFromJson(json); + factory UserProfileData.fromJson(Map json) => _$UserProfileDataFromJson(json); Map toJson() => _$UserProfileDataToJson(this); @@ -85,7 +84,8 @@ class UserProfileData { personsById.hashCode; @override - String toString() => 'UserProfileData{' + String toString() => + 'UserProfileData{' 'firstName: $firstName, ' 'lastName: $lastName, ' 'standardLanguage: $standardLanguage, ' @@ -98,17 +98,15 @@ class UserProfileData { 'persons: $persons, ' 'personsById: $personsById' '}'; + } const deserializeUserProfileData = UserProfileData.fromJson; -Map serializeUserProfileData(UserProfileData object) => - object.toJson(); +Map serializeUserProfileData(UserProfileData object) => object.toJson(); -List deserializeUserProfileDataList( - List> jsonList) => - jsonList.map(UserProfileData.fromJson).toList(); +List deserializeUserProfileDataList(List> jsonList) + => jsonList.map(UserProfileData.fromJson).toList(); -List> serializeUserProfileDataList( - List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeUserProfileDataList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/user/profile/user_profile_data_extended.dart b/example/lib/model/user/profile/user_profile_data_extended.dart index c0e77fb..532c1a6 100644 --- a/example/lib/model/user/profile/user_profile_data_extended.dart +++ b/example/lib/model/user/profile/user_profile_data_extended.dart @@ -42,8 +42,7 @@ class UserProfileDataExtended extends UserProfileData { personsById: personsById, ); - factory UserProfileDataExtended.fromJson(Map json) => - _$UserProfileDataExtendedFromJson(json); + factory UserProfileDataExtended.fromJson(Map json) => _$UserProfileDataExtendedFromJson(json); @override Map toJson() => _$UserProfileDataExtendedToJson(this); @@ -57,10 +56,13 @@ class UserProfileDataExtended extends UserProfileData { super == other; @override - int get hashCode => additionalField.hashCode ^ super.hashCode; + int get hashCode => + additionalField.hashCode ^ + super.hashCode; @override - String toString() => 'UserProfileDataExtended{' + String toString() => + 'UserProfileDataExtended{' 'additionalField: $additionalField, ' 'firstName: $firstName, ' 'lastName: $lastName, ' @@ -74,18 +76,15 @@ class UserProfileDataExtended extends UserProfileData { 'persons: $persons, ' 'personsById: $personsById' '}'; + } const deserializeUserProfileDataExtended = UserProfileDataExtended.fromJson; -Map serializeUserProfileDataExtended( - UserProfileDataExtended object) => - object.toJson(); +Map serializeUserProfileDataExtended(UserProfileDataExtended object) => object.toJson(); -List deserializeUserProfileDataExtendedList( - List> jsonList) => - jsonList.map(UserProfileDataExtended.fromJson).toList(); +List deserializeUserProfileDataExtendedList(List> jsonList) + => jsonList.map(UserProfileDataExtended.fromJson).toList(); -List> serializeUserProfileDataExtendedList( - List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeUserProfileDataExtendedList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/user/project/project.dart b/example/lib/model/user/project/project.dart index b9afa89..5da61e1 100644 --- a/example/lib/model/user/project/project.dart +++ b/example/lib/model/user/project/project.dart @@ -9,16 +9,11 @@ part 'project.g.dart'; @JsonSerializable(explicitToJson: true) @immutable class Project { - @JsonKey( - name: 'name', - required: false, - disallowNullValue: false, - includeIfNull: false) + @JsonKey(name: 'name', required: false, disallowNullValue: false, includeIfNull: false) final String name; @JsonKey(name: 'cost', includeIfNull: false) final double? cost; - @JsonKey( - name: 'status', includeIfNull: false, unknownEnumValue: Status.STATUS_0) + @JsonKey(name: 'status', includeIfNull: false, unknownEnumValue: Status.STATUS_0) final Status? status; const Project({ @@ -27,8 +22,7 @@ class Project { this.status, }); - factory Project.fromJson(Object? json) => - _$ProjectFromJson(json as Map); // ignore: avoid_as + factory Project.fromJson(Object? json) => _$ProjectFromJson(json as Map); // ignore: avoid_as Map toJson() => _$ProjectToJson(this); @@ -45,22 +39,27 @@ class Project { status == other.status; @override - int get hashCode => name.hashCode ^ cost.hashCode ^ status.hashCode; + int get hashCode => + name.hashCode ^ + cost.hashCode ^ + status.hashCode; @override - String toString() => 'Project{' + String toString() => + 'Project{' 'name: $name, ' 'cost: $cost, ' 'status: $status' '}'; + } const deserializeProject = Project.fromJson; Map serializeProject(Project object) => object.toJson(); -List deserializeProjectList(List> jsonList) => - jsonList.map(Project.fromJson).toList(); +List deserializeProjectList(List> jsonList) + => jsonList.map(Project.fromJson).toList(); -List> serializeProjectList(List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeProjectList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/lib/model/user/testing.dart b/example/lib/model/user/testing.dart index d99ceed..cde1781 100644 --- a/example/lib/model/user/testing.dart +++ b/example/lib/model/user/testing.dart @@ -10,11 +10,7 @@ part 'testing.g.dart'; class Testing { @JsonKey(name: 'beneficiary', required: true, includeIfNull: false) final String beneficiary; - @JsonKey( - name: 'isFavourite', - includeIfNull: false, - includeFromJson: false, - includeToJson: false) + @JsonKey(name: 'isFavourite', includeIfNull: false, includeFromJson: false, includeToJson: false) String? isFavourite; @JsonKey(name: 'structuredMessage', includeIfNull: false) final String? structuredMessage; @@ -24,11 +20,7 @@ class Testing { final dynamic dynamicField; @JsonKey(name: 'duration', includeIfNull: false) final Duration? duration; - @JsonKey( - name: 'duration_from_json_test', - includeIfNull: false, - fromJson: handleDurationFromToJsonFromJson, - toJson: handleDurationFromToJsonToJson) + @JsonKey(name: 'duration_from_json_test', includeIfNull: false, fromJson: handleDurationFromToJsonFromJson, toJson: handleDurationFromToJsonToJson) final DurationFromToJson? durationFromJsonTest; Testing({ @@ -41,18 +33,18 @@ class Testing { this.durationFromJsonTest, }); - factory Testing.fromJson(Map json) => - _$TestingFromJson(json); + factory Testing.fromJson(Map json) => _$TestingFromJson(json); Map toJson() => _$TestingToJson(this); + } const deserializeTesting = Testing.fromJson; Map serializeTesting(Testing object) => object.toJson(); -List deserializeTestingList(List> jsonList) => - jsonList.map(Testing.fromJson).toList(); +List deserializeTestingList(List> jsonList) + => jsonList.map(Testing.fromJson).toList(); -List> serializeTestingList(List objects) => - objects.map((object) => object.toJson()).toList(); +List> serializeTestingList(List objects) + => objects.map((object) => object.toJson()).toList(); diff --git a/example/model_generator/enums.yaml b/example/model_generator/enums.yaml index c82c919..a2ca01a 100644 --- a/example/model_generator/enums.yaml +++ b/example/model_generator/enums.yaml @@ -2,51 +2,76 @@ Gender: path: user/person/ type: enum properties: + value: + type: String + is_json_key: true + values: MALE: - value: _mAl3 + properties: + value: _mAl3 FEMALE: - value: femAle + properties: + value: femAle X: - value: X + properties: + value: X GENDER_X: + properties: + value: gender_x GENDER_Y: - value: + properties: + value: gender_y GENDER_z: - value: gender_z + properties: + value: gender_z GENDER_abC: + properties: + value: gender_abc GENDER_def: - value: + properties: + value: gender_def GENDER_lap: - value: GENDER_lap + properties: + value: GENDER_lap Status: path: status type: enum - item_type: int - generate_map: true - generate_extensions: true properties: + value: + type: int + is_json_key: true + values: status_0: - value: 0 + properties: + value: 0 status_1: - value: 1 + properties: + value: 1 status_2: - value: 2 + properties: + value: 2 status_3: - value: 3 + properties: + value: 3 DoubleStatus: path: status type: enum - item_type: double - generate_map: true - generate_extensions: true properties: + value: + type: double + is_json_key: true + values: status_0: - value: 0.0 + properties: + value: 0.1 status_1: - value: 1.0 + properties: + value: 1.1 status_2: - value: 2.0 + properties: + value: 2.2 status_3: - value: 3.0 + properties: + value: 3.3 diff --git a/lib/config/yml_generator_config.dart b/lib/config/yml_generator_config.dart index 937096a..2c477bc 100644 --- a/lib/config/yml_generator_config.dart +++ b/lib/config/yml_generator_config.dart @@ -91,6 +91,21 @@ class YmlGeneratorConfig { throw Exception('Properties should be a map, right now you are using a ${properties.runtimeType}. model: $key'); } if (type == 'enum') { + final deprecatedItemType = value['item_type']; + if (deprecatedItemType != null) { + throw Exception('item_type is removed, follow the migration to version 7.0.0'); + } + + final deprecatedGenerateExtensions = value['generate_extensions']; + if (deprecatedGenerateExtensions != null) { + throw Exception('generate_extensions is removed, follow the migration to version 7.0.0'); + } + + final deprecatedGenerateMap = value['generate_map']; + if (deprecatedGenerateMap != null) { + throw Exception('generate_map is removed, follow the migration to version 7.0.0'); + } + final uppercaseEnums = (value['uppercase_enums'] ?? pubspecConfig.uppercaseEnums) == true; final fields = []; @@ -102,7 +117,7 @@ class YmlGeneratorConfig { final ItemType itemType; final String name = propertyKey; - + if (propertyValue is YamlMap) { type = propertyValue['type']; isJsonKey = propertyValue['is_json_key'] == true; diff --git a/test/writer/enum_model_reader_test.dart b/test/writer/enum_model_reader_test.dart index 891115a..44cc437 100644 --- a/test/writer/enum_model_reader_test.dart +++ b/test/writer/enum_model_reader_test.dart @@ -249,6 +249,49 @@ Gender: description: this is a enum of female properties: isMale: hello +""", + )); + + test( + 'item_type not supported anymore', + () => testEnumError( + expectedError: 'Exception: item_type is removed, follow the migration to version 7.0.0', + enumYml: """ +Gender: + path: user/person/ + type: enum + item_type: double + values: + MALE: + FEMALE: +""", + )); + test( + 'generate_map not supported anymore', + () => testEnumError( + expectedError: 'Exception: generate_map is removed, follow the migration to version 7.0.0', + enumYml: """ +Gender: + path: user/person/ + type: enum + generate_map: true + values: + MALE: + FEMALE: +""", + )); + test( + 'generate_extensions not supported anymore', + () => testEnumError( + expectedError: 'Exception: generate_extensions is removed, follow the migration to version 7.0.0', + enumYml: """ +Gender: + path: user/person/ + type: enum + generate_extensions: true + values: + MALE: + FEMALE: """, )); });