From 678f48d35cbf5381562d1c401e833902b2f4c528 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 10:03:50 +0100 Subject: [PATCH 1/7] CORE-12411 - Add reason for user in decline registration command --- .../command/registration/mgm/DeclineRegistration.avsc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc index 4faf7f21d5..eeda245942 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc @@ -6,8 +6,16 @@ "fields": [ { "name": "reason", - "doc": "Reason that the request was declined.", + "doc": "Reason that the request was declined. This contains data that will remain internal in the MGM's system for record keeping.", "type": "string" + }, + { + "name": "reasonForUser", + "doc": "Reason that the request was declined. This contains data that will be communicated to the user to provide context. If not specified, no reason will be communicated back to the user.", + "type": [ + "null", + "string" + ], } ] } \ No newline at end of file From 07091359e9ab857e5a336ba96f2af0a4d74b1e0d Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 11:09:12 +0100 Subject: [PATCH 2/7] Remove redundant comma --- .../command/registration/mgm/DeclineRegistration.avsc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc index eeda245942..3fd7b5e2ad 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc @@ -15,7 +15,7 @@ "type": [ "null", "string" - ], + ] } ] } \ No newline at end of file From 6a3b54c7581bc6d7532d8dd89aa46ec2f832a4a3 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 11:29:06 +0100 Subject: [PATCH 3/7] Add default value for backwards compatibility --- .../command/registration/mgm/DeclineRegistration.avsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc index 3fd7b5e2ad..b230f05297 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/command/registration/mgm/DeclineRegistration.avsc @@ -15,7 +15,8 @@ "type": [ "null", "string" - ] + ], + "default": null } ] } \ No newline at end of file From 3c4cd7a22fb5a93453cacacaeca1bd1966733df2 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 11:55:50 +0100 Subject: [PATCH 4/7] Add test and bump version --- .../DeclineRegistrationCompatibilityTest.kt | 43 +++++++++++++++++++ gradle.properties | 2 +- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 data/avro-schema/src/test/kotlin/net/corda/data/command/registration/mgm/DeclineRegistrationCompatibilityTest.kt diff --git a/data/avro-schema/src/test/kotlin/net/corda/data/command/registration/mgm/DeclineRegistrationCompatibilityTest.kt b/data/avro-schema/src/test/kotlin/net/corda/data/command/registration/mgm/DeclineRegistrationCompatibilityTest.kt new file mode 100644 index 0000000000..fea285f523 --- /dev/null +++ b/data/avro-schema/src/test/kotlin/net/corda/data/command/registration/mgm/DeclineRegistrationCompatibilityTest.kt @@ -0,0 +1,43 @@ +package net.corda.data.command.registration.mgm + +import net.corda.data.membership.command.registration.mgm.DeclineRegistration +import org.apache.avro.Schema +import org.apache.avro.SchemaCompatibility +import org.junit.jupiter.api.Assertions +import org.junit.jupiter.api.Test + +class DeclineRegistrationCompatibilityTest { + + @Test + fun `Changes in DeclineRegistration command between Corda 5_0 and 5_1 are compatible`() { + val oldSchemaJson = """ + { + "type": "record", + "name": "DeclineRegistration", + "namespace": "net.corda.data.membership.command.registration.mgm", + "doc": "Command issued when a member registration has been declined and needs to be updated to declined status.", + "fields": [ + { + "name": "reason", + "doc": "Reason that the request was declined. This contains data that will remain internal in the MGM's system for record keeping.", + "type": "string" + } + ] + } + """.trimIndent() + + val oldSchema = Schema.Parser() + .parse(oldSchemaJson) + + val newSchema = DeclineRegistration.`SCHEMA$` + + val compatibility = SchemaCompatibility.checkReaderWriterCompatibility(newSchema, oldSchema) + + Assertions.assertEquals( + compatibility.type, + SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE, + "Failed due to incompatible change. ${compatibility.description}" + ) + } + +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 4c6f568ae3..2c23954d9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 22 +cordaApiRevision = 23 # Main kotlinVersion = 1.8.21 From 6a4c2351d31d7732f9191203bd08ed1d029aff89 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 14:36:25 +0100 Subject: [PATCH 5/7] Add reason in set own registration status type --- .../data/membership/p2p/v2/SetOwnRegistrationStatus.avsc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc index f58ed8ee4c..2167d3f7ad 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc @@ -16,6 +16,14 @@ "name": "newStatus", "doc": "The new registration status.", "type": "net.corda.data.membership.common.v2.RegistrationStatus" + }, + { + "name": "reason", + "doc": "The reason the registration request was moved to this status. Mostly relevant for switches to negative statuses (e.g. declined) to provide further context to the user on the underlying reason." + "type": [ + "null", + "string" + ], } ] } \ No newline at end of file From 4a934eef37fdd8c138d6119959f248719d76ae11 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Mon, 25 Sep 2023 14:51:41 +0100 Subject: [PATCH 6/7] Fix syntax --- .../data/membership/p2p/v2/SetOwnRegistrationStatus.avsc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc index 2167d3f7ad..82030cf4fc 100644 --- a/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc +++ b/data/avro-schema/src/main/resources/avro/net/corda/data/membership/p2p/v2/SetOwnRegistrationStatus.avsc @@ -19,11 +19,11 @@ }, { "name": "reason", - "doc": "The reason the registration request was moved to this status. Mostly relevant for switches to negative statuses (e.g. declined) to provide further context to the user on the underlying reason." + "doc": "The reason the registration request was moved to this status. Mostly relevant for switches to negative statuses (e.g. declined) to provide further context to the user on the underlying reason.", "type": [ "null", "string" - ], + ] } ] } \ No newline at end of file From fb48dee8976760f981df30584673af103ac92c74 Mon Sep 17 00:00:00 2001 From: Dimos Raptis Date: Tue, 26 Sep 2023 15:21:13 +0100 Subject: [PATCH 7/7] Bumping api version --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 2c23954d9b..10fdad95d7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ cordaProductVersion = 5.1.0 # NOTE: update this each time this module contains a breaking change ## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to ## a per module property in which case module versions can change independently. -cordaApiRevision = 23 +cordaApiRevision = 24 # Main kotlinVersion = 1.8.21