Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-12411 - Add reason for user in decline registration command #1261

Merged
merged 9 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
]
}
Original file line number Diff line number Diff line change
@@ -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}"
)
}

}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down