From 2877ad179e3c222418e29dbbc28143e963c0cd9e Mon Sep 17 00:00:00 2001 From: chirag Date: Fri, 13 Nov 2020 11:04:28 +0000 Subject: [PATCH] Change type of version parameter in AwsCognitoEvent from number to string --- data/cognito_event.json | 2 +- lib/events/cognito_event.dart | 2 +- lib/events/cognito_event.g.dart | 2 +- test/cognito_event_test.dart | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/cognito_event.json b/data/cognito_event.json index 6dee8245..22ca0cd3 100644 --- a/data/cognito_event.json +++ b/data/cognito_event.json @@ -1,5 +1,5 @@ { - "version": 1, + "version": "1", "triggerSource": "CustomMessage_SignUp/CustomMessage_ResendCode/CustomMessage_ForgotPassword/CustomMessage_VerifyUserAttribute", "region": "eu-west-1", "userPoolId": "1234567", diff --git a/lib/events/cognito_event.dart b/lib/events/cognito_event.dart index 4c8862f3..d9f3529f 100644 --- a/lib/events/cognito_event.dart +++ b/lib/events/cognito_event.dart @@ -5,7 +5,7 @@ part 'cognito_event.g.dart'; @JsonSerializable() class AwsCognitoEvent { @JsonKey() - final int version; + final String version; @JsonKey() final String triggerSource; diff --git a/lib/events/cognito_event.g.dart b/lib/events/cognito_event.g.dart index 99584150..18d3a72a 100644 --- a/lib/events/cognito_event.g.dart +++ b/lib/events/cognito_event.g.dart @@ -8,7 +8,7 @@ part of 'cognito_event.dart'; AwsCognitoEvent _$AwsCognitoEventFromJson(Map json) { return AwsCognitoEvent( - version: json['version'] as int, + version: json['version'] as String, triggerSource: json['triggerSource'] as String, region: json['region'] as String, userPoolId: json['userPoolId'] as String, diff --git a/test/cognito_event_test.dart b/test/cognito_event_test.dart index 24ba6966..8b0ca247 100644 --- a/test/cognito_event_test.dart +++ b/test/cognito_event_test.dart @@ -14,7 +14,7 @@ void main() { test("json got parsed and creates an event", () async { final event = AwsCognitoEvent.fromJson(json); - expect(event.version, equals(1)); + expect(event.version, equals("1")); expect(event.userPoolId, equals("1234567")); expect(event.userName, equals("foo")); expect(event.response.smsMessage, equals("foo"));