diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.g.dart index 6158588c2b..3ac604d93d 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/amplify_outputs.g.dart @@ -9,29 +9,46 @@ part of 'amplify_outputs.dart'; // ************************************************************************** AmplifyOutputs _$AmplifyOutputsFromJson(Map json) => - AmplifyOutputs( - schema: json['schema'] as String?, - version: json['version'] as String, - analytics: json['analytics'] == null - ? null - : AnalyticsOutputs.fromJson( - json['analytics'] as Map), - auth: json['auth'] == null - ? null - : AuthOutputs.fromJson(json['auth'] as Map), - data: _dataFromJson(json['data'] as Map?), - restApi: (json['rest_api'] as Map?)?.map( - (k, e) => - MapEntry(k, RestApiOutputs.fromJson(e as Map)), - ), - notifications: json['notifications'] == null - ? null - : NotificationsOutputs.fromJson( - json['notifications'] as Map), - storage: json['storage'] == null - ? null - : StorageOutputs.fromJson(json['storage'] as Map), - custom: json['custom'] as Map?, + $checkedCreate( + 'AmplifyOutputs', + json, + ($checkedConvert) { + final val = AmplifyOutputs( + schema: $checkedConvert('schema', (v) => v as String?), + version: $checkedConvert('version', (v) => v as String), + analytics: $checkedConvert( + 'analytics', + (v) => v == null + ? null + : AnalyticsOutputs.fromJson(v as Map)), + auth: $checkedConvert( + 'auth', + (v) => v == null + ? null + : AuthOutputs.fromJson(v as Map)), + data: $checkedConvert( + 'data', (v) => _dataFromJson(v as Map?)), + restApi: $checkedConvert( + 'rest_api', + (v) => (v as Map?)?.map( + (k, e) => MapEntry( + k, RestApiOutputs.fromJson(e as Map)), + )), + notifications: $checkedConvert( + 'notifications', + (v) => v == null + ? null + : NotificationsOutputs.fromJson(v as Map)), + storage: $checkedConvert( + 'storage', + (v) => v == null + ? null + : StorageOutputs.fromJson(v as Map)), + custom: $checkedConvert('custom', (v) => v as Map?), + ); + return val; + }, + fieldKeyMap: const {'restApi': 'rest_api'}, ); Map _$AmplifyOutputsToJson(AmplifyOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.g.dart index bf957138f7..e995e1c3a2 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/analytics/amazon_pinpoint_outputs.g.dart @@ -10,9 +10,17 @@ part of 'amazon_pinpoint_outputs.dart'; AmazonPinpointOutputs _$AmazonPinpointOutputsFromJson( Map json) => - AmazonPinpointOutputs( - awsRegion: json['aws_region'] as String, - appId: json['app_id'] as String, + $checkedCreate( + 'AmazonPinpointOutputs', + json, + ($checkedConvert) { + final val = AmazonPinpointOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + appId: $checkedConvert('app_id', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const {'awsRegion': 'aws_region', 'appId': 'app_id'}, ); Map _$AmazonPinpointOutputsToJson( diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.g.dart index f567e72873..ee4a580cf4 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/analytics/analytics_outputs.g.dart @@ -9,11 +9,20 @@ part of 'analytics_outputs.dart'; // ************************************************************************** AnalyticsOutputs _$AnalyticsOutputsFromJson(Map json) => - AnalyticsOutputs( - amazonPinpoint: json['amazon_pinpoint'] == null - ? null - : AmazonPinpointOutputs.fromJson( - json['amazon_pinpoint'] as Map), + $checkedCreate( + 'AnalyticsOutputs', + json, + ($checkedConvert) { + final val = AnalyticsOutputs( + amazonPinpoint: $checkedConvert( + 'amazon_pinpoint', + (v) => v == null + ? null + : AmazonPinpointOutputs.fromJson(v as Map)), + ); + return val; + }, + fieldKeyMap: const {'amazonPinpoint': 'amazon_pinpoint'}, ); Map _$AnalyticsOutputsToJson(AnalyticsOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart index ebad46ddca..f278972143 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/auth/auth_outputs.g.dart @@ -8,39 +8,74 @@ part of 'auth_outputs.dart'; // JsonSerializableGenerator // ************************************************************************** -AuthOutputs _$AuthOutputsFromJson(Map json) => AuthOutputs( - awsRegion: json['aws_region'] as String, - userPoolId: json['user_pool_id'] as String?, - userPoolClientId: json['user_pool_client_id'] as String?, - appClientSecret: json['app_client_secret'] as String?, - identityPoolId: json['identity_pool_id'] as String?, - passwordPolicy: json['password_policy'] == null - ? null - : PasswordPolicy.fromJson( - json['password_policy'] as Map), - oauth: json['oauth'] == null - ? null - : OAuthOutputs.fromJson(json['oauth'] as Map), - standardRequiredAttributes: (json['standard_required_attributes'] - as List?) - ?.map((e) => - const CognitoUserAttributeKeyConverter().fromJson(e as String)) - .toList(), - usernameAttributes: (json['username_attributes'] as List?) - ?.map((e) => - const CognitoUserAttributeKeyConverter().fromJson(e as String)) - .toList(), - userVerificationTypes: (json['user_verification_types'] as List?) - ?.map((e) => - const CognitoUserAttributeKeyConverter().fromJson(e as String)) - .toList(), - unauthenticatedIdentitiesEnabled: - json['unauthenticated_identities_enabled'] as bool? ?? true, - mfaConfiguration: $enumDecodeNullable( - _$MfaEnforcementEnumMap, json['mfa_configuration']), - mfaMethods: (json['mfa_methods'] as List?) - ?.map((e) => $enumDecode(_$MfaMethodEnumMap, e)) - .toList(), +AuthOutputs _$AuthOutputsFromJson(Map json) => $checkedCreate( + 'AuthOutputs', + json, + ($checkedConvert) { + final val = AuthOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + userPoolId: $checkedConvert('user_pool_id', (v) => v as String?), + userPoolClientId: + $checkedConvert('user_pool_client_id', (v) => v as String?), + appClientSecret: + $checkedConvert('app_client_secret', (v) => v as String?), + identityPoolId: + $checkedConvert('identity_pool_id', (v) => v as String?), + passwordPolicy: $checkedConvert( + 'password_policy', + (v) => v == null + ? null + : PasswordPolicy.fromJson(v as Map)), + oauth: $checkedConvert( + 'oauth', + (v) => v == null + ? null + : OAuthOutputs.fromJson(v as Map)), + standardRequiredAttributes: $checkedConvert( + 'standard_required_attributes', + (v) => (v as List?) + ?.map((e) => const CognitoUserAttributeKeyConverter() + .fromJson(e as String)) + .toList()), + usernameAttributes: $checkedConvert( + 'username_attributes', + (v) => (v as List?) + ?.map((e) => const CognitoUserAttributeKeyConverter() + .fromJson(e as String)) + .toList()), + userVerificationTypes: $checkedConvert( + 'user_verification_types', + (v) => (v as List?) + ?.map((e) => const CognitoUserAttributeKeyConverter() + .fromJson(e as String)) + .toList()), + unauthenticatedIdentitiesEnabled: $checkedConvert( + 'unauthenticated_identities_enabled', (v) => v as bool? ?? true), + mfaConfiguration: $checkedConvert('mfa_configuration', + (v) => $enumDecodeNullable(_$MfaEnforcementEnumMap, v)), + mfaMethods: $checkedConvert( + 'mfa_methods', + (v) => (v as List?) + ?.map((e) => $enumDecode(_$MfaMethodEnumMap, e)) + .toList()), + ); + return val; + }, + fieldKeyMap: const { + 'awsRegion': 'aws_region', + 'userPoolId': 'user_pool_id', + 'userPoolClientId': 'user_pool_client_id', + 'appClientSecret': 'app_client_secret', + 'identityPoolId': 'identity_pool_id', + 'passwordPolicy': 'password_policy', + 'standardRequiredAttributes': 'standard_required_attributes', + 'usernameAttributes': 'username_attributes', + 'userVerificationTypes': 'user_verification_types', + 'unauthenticatedIdentitiesEnabled': + 'unauthenticated_identities_enabled', + 'mfaConfiguration': 'mfa_configuration', + 'mfaMethods': 'mfa_methods' + }, ); Map _$AuthOutputsToJson(AuthOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/auth/oauth_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/auth/oauth_outputs.g.dart index 3c04c2e51c..f59d2d6d3b 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/auth/oauth_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/auth/oauth_outputs.g.dart @@ -8,36 +8,59 @@ part of 'oauth_outputs.dart'; // JsonSerializableGenerator // ************************************************************************** -OAuthOutputs _$OAuthOutputsFromJson(Map json) => OAuthOutputs( - identityProviders: (json['identity_providers'] as List) - .map((e) => $enumDecode(_$IdentityProviderEnumMap, e)) - .toList(), - domain: json['domain'] as String, - scopes: - (json['scopes'] as List).map((e) => e as String).toList(), - redirectSignInUri: (json['redirect_sign_in_uri'] as List) - .map((e) => e as String) - .toList(), - signInUri: json['sign_in_uri'] as String?, - signInUriQueryParameters: - (json['sign_in_uri_query_parameters'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - redirectSignOutUri: (json['redirect_sign_out_uri'] as List) - .map((e) => e as String) - .toList(), - signOutUri: json['sign_out_uri'] as String?, - signOutUriQueryParameters: - (json['sign_out_uri_query_parameters'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - tokenUri: json['token_uri'] as String?, - tokenUriQueryParameters: - (json['token_uri_query_parameters'] as Map?)?.map( - (k, e) => MapEntry(k, e as String), - ), - responseType: - $enumDecode(_$OAuthResponseTypeEnumMap, json['response_type']), +OAuthOutputs _$OAuthOutputsFromJson(Map json) => + $checkedCreate( + 'OAuthOutputs', + json, + ($checkedConvert) { + final val = OAuthOutputs( + identityProviders: $checkedConvert( + 'identity_providers', + (v) => (v as List) + .map((e) => $enumDecode(_$IdentityProviderEnumMap, e)) + .toList()), + domain: $checkedConvert('domain', (v) => v as String), + scopes: $checkedConvert('scopes', + (v) => (v as List).map((e) => e as String).toList()), + redirectSignInUri: $checkedConvert('redirect_sign_in_uri', + (v) => (v as List).map((e) => e as String).toList()), + signInUri: $checkedConvert('sign_in_uri', (v) => v as String?), + signInUriQueryParameters: $checkedConvert( + 'sign_in_uri_query_parameters', + (v) => (v as Map?)?.map( + (k, e) => MapEntry(k, e as String), + )), + redirectSignOutUri: $checkedConvert('redirect_sign_out_uri', + (v) => (v as List).map((e) => e as String).toList()), + signOutUri: $checkedConvert('sign_out_uri', (v) => v as String?), + signOutUriQueryParameters: $checkedConvert( + 'sign_out_uri_query_parameters', + (v) => (v as Map?)?.map( + (k, e) => MapEntry(k, e as String), + )), + tokenUri: $checkedConvert('token_uri', (v) => v as String?), + tokenUriQueryParameters: $checkedConvert( + 'token_uri_query_parameters', + (v) => (v as Map?)?.map( + (k, e) => MapEntry(k, e as String), + )), + responseType: $checkedConvert('response_type', + (v) => $enumDecode(_$OAuthResponseTypeEnumMap, v)), + ); + return val; + }, + fieldKeyMap: const { + 'identityProviders': 'identity_providers', + 'redirectSignInUri': 'redirect_sign_in_uri', + 'signInUri': 'sign_in_uri', + 'signInUriQueryParameters': 'sign_in_uri_query_parameters', + 'redirectSignOutUri': 'redirect_sign_out_uri', + 'signOutUri': 'sign_out_uri', + 'signOutUriQueryParameters': 'sign_out_uri_query_parameters', + 'tokenUri': 'token_uri', + 'tokenUriQueryParameters': 'token_uri_query_parameters', + 'responseType': 'response_type' + }, ); Map _$OAuthOutputsToJson(OAuthOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/auth/password_policy.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/auth/password_policy.g.dart index 951e3483af..97b4b536ea 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/auth/password_policy.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/auth/password_policy.g.dart @@ -9,12 +9,30 @@ part of 'password_policy.dart'; // ************************************************************************** PasswordPolicy _$PasswordPolicyFromJson(Map json) => - PasswordPolicy( - minLength: json['min_length'] as int?, - requireNumbers: json['require_numbers'] as bool? ?? false, - requireLowercase: json['require_lowercase'] as bool? ?? false, - requireUppercase: json['require_uppercase'] as bool? ?? false, - requireSymbols: json['require_symbols'] as bool? ?? false, + $checkedCreate( + 'PasswordPolicy', + json, + ($checkedConvert) { + final val = PasswordPolicy( + minLength: $checkedConvert('min_length', (v) => v as int?), + requireNumbers: + $checkedConvert('require_numbers', (v) => v as bool? ?? false), + requireLowercase: + $checkedConvert('require_lowercase', (v) => v as bool? ?? false), + requireUppercase: + $checkedConvert('require_uppercase', (v) => v as bool? ?? false), + requireSymbols: + $checkedConvert('require_symbols', (v) => v as bool? ?? false), + ); + return val; + }, + fieldKeyMap: const { + 'minLength': 'min_length', + 'requireNumbers': 'require_numbers', + 'requireLowercase': 'require_lowercase', + 'requireUppercase': 'require_uppercase', + 'requireSymbols': 'require_symbols' + }, ); Map _$PasswordPolicyToJson(PasswordPolicy instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/data/data_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/data/data_outputs.g.dart index fa4155dffa..1850349707 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/data/data_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/data/data_outputs.g.dart @@ -8,15 +8,31 @@ part of 'data_outputs.dart'; // JsonSerializableGenerator // ************************************************************************** -DataOutputs _$DataOutputsFromJson(Map json) => DataOutputs( - awsRegion: json['aws_region'] as String, - url: json['url'] as String, - apiKey: json['api_key'] as String?, - defaultAuthorizationType: $enumDecode( - _$APIAuthorizationTypeEnumMap, json['default_authorization_type']), - authorizationTypes: (json['authorization_types'] as List) - .map((e) => $enumDecode(_$APIAuthorizationTypeEnumMap, e)) - .toList(), +DataOutputs _$DataOutputsFromJson(Map json) => $checkedCreate( + 'DataOutputs', + json, + ($checkedConvert) { + final val = DataOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + url: $checkedConvert('url', (v) => v as String), + apiKey: $checkedConvert('api_key', (v) => v as String?), + defaultAuthorizationType: $checkedConvert( + 'default_authorization_type', + (v) => $enumDecode(_$APIAuthorizationTypeEnumMap, v)), + authorizationTypes: $checkedConvert( + 'authorization_types', + (v) => (v as List) + .map((e) => $enumDecode(_$APIAuthorizationTypeEnumMap, e)) + .toList()), + ); + return val; + }, + fieldKeyMap: const { + 'awsRegion': 'aws_region', + 'apiKey': 'api_key', + 'defaultAuthorizationType': 'default_authorization_type', + 'authorizationTypes': 'authorization_types' + }, ); Map _$DataOutputsToJson(DataOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/notifications/notifications_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/notifications/notifications_outputs.g.dart index b6e4b63c87..a1a0b37012 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/notifications/notifications_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/notifications/notifications_outputs.g.dart @@ -10,12 +10,26 @@ part of 'notifications_outputs.dart'; NotificationsOutputs _$NotificationsOutputsFromJson( Map json) => - NotificationsOutputs( - awsRegion: json['aws_region'] as String, - amazonPinpointAppId: json['amazon_pinpoint_app_id'] as String, - channels: (json['channels'] as List) - .map((e) => $enumDecode(_$AmazonPinpointChannelEnumMap, e)) - .toList(), + $checkedCreate( + 'NotificationsOutputs', + json, + ($checkedConvert) { + final val = NotificationsOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + amazonPinpointAppId: + $checkedConvert('amazon_pinpoint_app_id', (v) => v as String), + channels: $checkedConvert( + 'channels', + (v) => (v as List) + .map((e) => $enumDecode(_$AmazonPinpointChannelEnumMap, e)) + .toList()), + ); + return val; + }, + fieldKeyMap: const { + 'awsRegion': 'aws_region', + 'amazonPinpointAppId': 'amazon_pinpoint_app_id' + }, ); Map _$NotificationsOutputsToJson( diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/rest_api/rest_api_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/rest_api/rest_api_outputs.g.dart index 7ab36d0873..2834993493 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/rest_api/rest_api_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/rest_api/rest_api_outputs.g.dart @@ -9,12 +9,24 @@ part of 'rest_api_outputs.dart'; // ************************************************************************** RestApiOutputs _$RestApiOutputsFromJson(Map json) => - RestApiOutputs( - awsRegion: json['aws_region'] as String, - url: json['url'] as String, - apiKey: json['api_key'] as String?, - authorizationType: $enumDecode( - _$APIAuthorizationTypeEnumMap, json['authorization_type']), + $checkedCreate( + 'RestApiOutputs', + json, + ($checkedConvert) { + final val = RestApiOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + url: $checkedConvert('url', (v) => v as String), + apiKey: $checkedConvert('api_key', (v) => v as String?), + authorizationType: $checkedConvert('authorization_type', + (v) => $enumDecode(_$APIAuthorizationTypeEnumMap, v)), + ); + return val; + }, + fieldKeyMap: const { + 'awsRegion': 'aws_region', + 'apiKey': 'api_key', + 'authorizationType': 'authorization_type' + }, ); Map _$RestApiOutputsToJson(RestApiOutputs instance) { diff --git a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart index c672e2c4d6..7b90421189 100644 --- a/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart +++ b/packages/amplify_core/lib/src/config/amplify_outputs/storage/storage_outputs.g.dart @@ -9,9 +9,20 @@ part of 'storage_outputs.dart'; // ************************************************************************** StorageOutputs _$StorageOutputsFromJson(Map json) => - StorageOutputs( - awsRegion: json['aws_region'] as String, - bucketName: json['bucket_name'] as String, + $checkedCreate( + 'StorageOutputs', + json, + ($checkedConvert) { + final val = StorageOutputs( + awsRegion: $checkedConvert('aws_region', (v) => v as String), + bucketName: $checkedConvert('bucket_name', (v) => v as String), + ); + return val; + }, + fieldKeyMap: const { + 'awsRegion': 'aws_region', + 'bucketName': 'bucket_name' + }, ); Map _$StorageOutputsToJson(StorageOutputs instance) => diff --git a/packages/amplify_core/lib/src/util/serializable.dart b/packages/amplify_core/lib/src/util/serializable.dart index 72e0fdceef..4099d3f585 100644 --- a/packages/amplify_core/lib/src/util/serializable.dart +++ b/packages/amplify_core/lib/src/util/serializable.dart @@ -36,6 +36,7 @@ const zAmplifyOutputsSerializable = JsonSerializable( includeIfNull: false, explicitToJson: true, fieldRename: FieldRename.snake, + checked: true, converters: [ CognitoUserAttributeKeyConverter(), CognitoUserAttributeMapConverter(),