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..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 @@ -6,8 +6,17 @@ "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" + ], + "default": null } ] } \ No newline at end of file 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..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 @@ -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 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 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