Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 99ec2ff

Browse files
author
Peter Somogyvari
committed
build(connector-corda): fix various Unresolved reference kotlin compiler errors
1. Started overriding a specific template (dataClass.mustache) in the main-server sub-package of the corda connector because of issues that are further explained here [1] and here [2]. 2. Also had to update generator configuration to specifically exclude spring-doc generation because it seems to be broken within the template as well: it does not provide updated dependencies for the grandle and maven manifests and so the `io.swagger.core.v3:swagger-annotations` package was missing and failing the build in a second way. 3. The example value for the return array of `ListFlowsV1Response` in the openapi.json spec file of the corda connector was containing dollar signs ($) which ended up being appended to the kotlin code's annotations as documentation, but the dollar signs have a special meaning in kotlin and lead to syntax errors. Updating the examples to not have dollar signs in the openapi.json specification document resulted in fixing this issue. 4. Also updated the artifact version in the openapi generator configuration file. This is just a temporary fix, what we really need is scripts bumping this up as part of the automated release process. [1] OpenAPITools/openapi-generator#8366 (comment) [2] OpenAPITools/openapi-generator#17008 Fixes hyperledger-cacti#2662 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 9bee86b commit 99ec2ff

47 files changed

Lines changed: 68 additions & 333 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/cactus-plugin-ledger-connector-corda/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"generate-sdk": "run-p 'generate-sdk:*'",
4949
"generate-sdk:kotlin": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin -o ./src/main/kotlin/generated/openapi/kotlin-client/ --reserved-words-mappings protected=protected",
5050
"generate-sdk:typescript-axios": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g typescript-axios -o ./src/main/typescript/generated/openapi/typescript-axios/",
51-
"generate-server": "openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin-spring -o ./src/main-server/kotlin/gen/kotlin-spring/ -c ./src/main-server/openapi-generator-config.yaml",
51+
"generate-server": "yarn run --top-level openapi-generator-cli generate -i ./src/main/json/openapi.json -g kotlin-spring -o ./src/main-server/kotlin/gen/kotlin-spring/ -c ./src/main-server/openapi-generator-config.yaml",
5252
"watch": "npm-watch",
5353
"webpack": "npm-run-all webpack:dev",
5454
"webpack:dev": "npm-run-all webpack:dev:node webpack:dev:web",

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/.openapi-generator/FILES

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
README.md
22
pom.xml
33
settings.gradle
4-
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/HomeController.kt
5-
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/SpringDocConfiguration.kt
64
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt
75
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaService.kt
86
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiUtil.kt
@@ -42,4 +40,3 @@ src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/mode
4240
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/StopMonitorV1Response.kt
4341
src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/model/X500Principal.kt
4442
src/main/resources/application.yaml
45-
src/main/resources/openapi.yaml

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ By default a [`pom.xml`](pom.xml) file will be generated. If you specified `grad
1010

1111
To build the project using maven, run:
1212
```bash
13-
mvn package && java -jar target/cactus-connector-corda-server-0.3.0.jar
13+
mvn package && java -jar target/cactus-connector-corda-server-2.0.0-alpha.2.jar
1414
```
1515

1616
To build the project using gradle, run:
1717
```bash
18-
gradle build && java -jar build/libs/cactus-connector-corda-server-0.3.0.jar
18+
gradle build && java -jar build/libs/cactus-connector-corda-server-2.0.0-alpha.2.jar
1919
```
2020

2121
If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/)

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/pom.xml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
<artifactId>cactus-connector-corda-server</artifactId>
55
<packaging>jar</packaging>
66
<name>cactus-connector-corda-server</name>
7-
<version>0.3.0</version>
7+
<version>2.0.0-alpha.2</version>
88
<properties>
9-
<springdoc-openapi.version>1.6.8</springdoc-openapi.version>
109
<findbugs-jsr305.version>3.0.2</findbugs-jsr305.version>
1110
<jakarta-annotation.version>2.1.0</jakarta-annotation.version>
1211
<kotlin-test-junit5.version>1.6.21</kotlin-test-junit5.version>
@@ -86,12 +85,7 @@
8685
<artifactId>spring-boot-starter-web</artifactId>
8786
</dependency>
8887

89-
<!--SpringDoc dependencies -->
90-
<dependency>
91-
<groupId>org.springdoc</groupId>
92-
<artifactId>springdoc-openapi-ui</artifactId>
93-
<version>${springdoc-openapi.version}</version>
94-
</dependency>
88+
9589

9690
<!-- @Nullable annotation -->
9791
<dependency>

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/HomeController.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/SpringDocConfiguration.kt

Lines changed: 0 additions & 32 deletions
This file was deleted.

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/api/ApiPluginLedgerConnectorCordaController.kt

Lines changed: 19 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMo
1818
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StartMonitorV1Response
1919
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Request
2020
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.StopMonitorV1Response
21-
import io.swagger.v3.oas.annotations.*
22-
import io.swagger.v3.oas.annotations.enums.*
23-
import io.swagger.v3.oas.annotations.media.*
24-
import io.swagger.v3.oas.annotations.responses.*
25-
import io.swagger.v3.oas.annotations.security.*
2621
import org.springframework.http.HttpStatus
2722
import org.springframework.http.MediaType
2823
import org.springframework.http.ResponseEntity
@@ -50,82 +45,51 @@ import kotlin.collections.Map
5045
@RequestMapping("\${api.base-path:}")
5146
class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val service: ApiPluginLedgerConnectorCordaService) {
5247

53-
@Operation(
54-
summary = "Clear transactions from internal store so they'll not be available by GetMonitorTransactionsV1 anymore.",
55-
operationId = "clearMonitorTransactionsV1",
56-
description = """""",
57-
responses = [
58-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = ClearMonitorTransactionsV1Response::class))]) ]
59-
)
48+
6049
@RequestMapping(
6150
method = [RequestMethod.DELETE],
6251
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/clear-monitor-transactions"],
6352
produces = ["application/json"],
6453
consumes = ["application/json"]
6554
)
66-
fun clearMonitorTransactionsV1(@Parameter(description = "") @Valid @RequestBody(required = false) clearMonitorTransactionsV1Request: ClearMonitorTransactionsV1Request?): ResponseEntity<ClearMonitorTransactionsV1Response> {
55+
fun clearMonitorTransactionsV1( @Valid @RequestBody(required = false) clearMonitorTransactionsV1Request: ClearMonitorTransactionsV1Request?): ResponseEntity<ClearMonitorTransactionsV1Response> {
6756
return ResponseEntity(service.clearMonitorTransactionsV1(clearMonitorTransactionsV1Request), HttpStatus.valueOf(200))
6857
}
6958

70-
@Operation(
71-
summary = "Deploys a set of jar files (Cordapps, e.g. the contracts in Corda speak).",
72-
operationId = "deployContractJarsV1",
73-
description = """""",
74-
responses = [
75-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = DeployContractJarsSuccessV1Response::class))]),
76-
ApiResponse(responseCode = "400", description = "Bad Request", content = [Content(schema = Schema(implementation = DeployContractJarsBadRequestV1Response::class))]) ]
77-
)
59+
7860
@RequestMapping(
7961
method = [RequestMethod.POST],
8062
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/deploy-contract-jars"],
8163
produces = ["application/json"],
8264
consumes = ["application/json"]
8365
)
84-
fun deployContractJarsV1(@Parameter(description = "") @Valid @RequestBody(required = false) deployContractJarsV1Request: DeployContractJarsV1Request?): ResponseEntity<DeployContractJarsSuccessV1Response> {
66+
fun deployContractJarsV1( @Valid @RequestBody(required = false) deployContractJarsV1Request: DeployContractJarsV1Request?): ResponseEntity<DeployContractJarsSuccessV1Response> {
8567
return ResponseEntity(service.deployContractJarsV1(deployContractJarsV1Request), HttpStatus.valueOf(200))
8668
}
8769

88-
@Operation(
89-
summary = "",
90-
operationId = "diagnoseNodeV1",
91-
description = """Responds with diagnostic information about the Corda node""",
92-
responses = [
93-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = DiagnoseNodeV1Response::class))]) ]
94-
)
70+
9571
@RequestMapping(
9672
method = [RequestMethod.POST],
9773
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/diagnose-node"],
9874
produces = ["application/json"],
9975
consumes = ["application/json"]
10076
)
101-
fun diagnoseNodeV1(@Parameter(description = "") @Valid @RequestBody(required = false) diagnoseNodeV1Request: DiagnoseNodeV1Request?): ResponseEntity<DiagnoseNodeV1Response> {
77+
fun diagnoseNodeV1( @Valid @RequestBody(required = false) diagnoseNodeV1Request: DiagnoseNodeV1Request?): ResponseEntity<DiagnoseNodeV1Response> {
10278
return ResponseEntity(service.diagnoseNodeV1(diagnoseNodeV1Request), HttpStatus.valueOf(200))
10379
}
10480

105-
@Operation(
106-
summary = "Get transactions for monitored state classes.",
107-
operationId = "getMonitorTransactionsV1",
108-
description = """""",
109-
responses = [
110-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = GetMonitorTransactionsV1Response::class))]) ]
111-
)
81+
11282
@RequestMapping(
11383
method = [RequestMethod.GET],
11484
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-monitor-transactions"],
11585
produces = ["application/json"],
11686
consumes = ["application/json"]
11787
)
118-
fun getMonitorTransactionsV1(@Parameter(description = "") @Valid @RequestBody(required = false) getMonitorTransactionsV1Request: GetMonitorTransactionsV1Request?): ResponseEntity<GetMonitorTransactionsV1Response> {
88+
fun getMonitorTransactionsV1( @Valid @RequestBody(required = false) getMonitorTransactionsV1Request: GetMonitorTransactionsV1Request?): ResponseEntity<GetMonitorTransactionsV1Response> {
11989
return ResponseEntity(service.getMonitorTransactionsV1(getMonitorTransactionsV1Request), HttpStatus.valueOf(200))
12090
}
12191

122-
@Operation(
123-
summary = "Get the Prometheus Metrics",
124-
operationId = "getPrometheusMetricsV1",
125-
description = """""",
126-
responses = [
127-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = kotlin.String::class))]) ]
128-
)
92+
12993
@RequestMapping(
13094
method = [RequestMethod.GET],
13195
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/get-prometheus-exporter-metrics"],
@@ -135,88 +99,58 @@ class ApiPluginLedgerConnectorCordaController(@Autowired(required = true) val se
13599
return ResponseEntity(service.getPrometheusMetricsV1(), HttpStatus.valueOf(200))
136100
}
137101

138-
@Operation(
139-
summary = "Invokes a contract on a Corda ledger (e.g. a flow)",
140-
operationId = "invokeContractV1",
141-
description = """""",
142-
responses = [
143-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = InvokeContractV1Response::class))]) ]
144-
)
102+
145103
@RequestMapping(
146104
method = [RequestMethod.POST],
147105
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/invoke-contract"],
148106
produces = ["application/json"],
149107
consumes = ["application/json"]
150108
)
151-
fun invokeContractV1(@Parameter(description = "") @Valid @RequestBody(required = false) invokeContractV1Request: InvokeContractV1Request?): ResponseEntity<InvokeContractV1Response> {
109+
fun invokeContractV1( @Valid @RequestBody(required = false) invokeContractV1Request: InvokeContractV1Request?): ResponseEntity<InvokeContractV1Response> {
152110
return ResponseEntity(service.invokeContractV1(invokeContractV1Request), HttpStatus.valueOf(200))
153111
}
154112

155-
@Operation(
156-
summary = "",
157-
operationId = "listFlowsV1",
158-
description = """Responds with a list of the flows on the Corda node.""",
159-
responses = [
160-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = ListFlowsV1Response::class))]) ]
161-
)
113+
162114
@RequestMapping(
163115
method = [RequestMethod.POST],
164116
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/list-flows"],
165117
produces = ["application/json"],
166118
consumes = ["application/json"]
167119
)
168-
fun listFlowsV1(@Parameter(description = "") @Valid @RequestBody(required = false) listFlowsV1Request: ListFlowsV1Request?): ResponseEntity<ListFlowsV1Response> {
120+
fun listFlowsV1( @Valid @RequestBody(required = false) listFlowsV1Request: ListFlowsV1Request?): ResponseEntity<ListFlowsV1Response> {
169121
return ResponseEntity(service.listFlowsV1(listFlowsV1Request), HttpStatus.valueOf(200))
170122
}
171123

172-
@Operation(
173-
summary = "",
174-
operationId = "networkMapV1",
175-
description = """Responds with a snapshot of the network map as provided by the Corda RPC call: net.corda.core.messaging.CordaRPCOps public abstract fun networkMapSnapshot(): List<NodeInfo>""",
176-
responses = [
177-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = NodeInfo::class))]) ]
178-
)
124+
179125
@RequestMapping(
180126
method = [RequestMethod.POST],
181127
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/network-map"],
182128
produces = ["application/json"],
183129
consumes = ["application/json"]
184130
)
185-
fun networkMapV1(@Parameter(description = "") @Valid @RequestBody(required = false) body: kotlin.Any?): ResponseEntity<List<NodeInfo>> {
131+
fun networkMapV1( @Valid @RequestBody(required = false) body: kotlin.Any?): ResponseEntity<List<NodeInfo>> {
186132
return ResponseEntity(service.networkMapV1(body), HttpStatus.valueOf(200))
187133
}
188134

189-
@Operation(
190-
summary = "Start monitoring corda changes (transactions) of given state class",
191-
operationId = "startMonitorV1",
192-
description = """""",
193-
responses = [
194-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = StartMonitorV1Response::class))]) ]
195-
)
135+
196136
@RequestMapping(
197137
method = [RequestMethod.POST],
198138
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/start-monitor"],
199139
produces = ["application/json"],
200140
consumes = ["application/json"]
201141
)
202-
fun startMonitorV1(@Parameter(description = "") @Valid @RequestBody(required = false) startMonitorV1Request: StartMonitorV1Request?): ResponseEntity<StartMonitorV1Response> {
142+
fun startMonitorV1( @Valid @RequestBody(required = false) startMonitorV1Request: StartMonitorV1Request?): ResponseEntity<StartMonitorV1Response> {
203143
return ResponseEntity(service.startMonitorV1(startMonitorV1Request), HttpStatus.valueOf(200))
204144
}
205145

206-
@Operation(
207-
summary = "Stop monitoring corda changes (transactions) of given state class",
208-
operationId = "stopMonitorV1",
209-
description = """""",
210-
responses = [
211-
ApiResponse(responseCode = "200", description = "OK", content = [Content(schema = Schema(implementation = StopMonitorV1Response::class))]) ]
212-
)
146+
213147
@RequestMapping(
214148
method = [RequestMethod.DELETE],
215149
value = ["/api/v1/plugins/@hyperledger/cactus-plugin-ledger-connector-corda/stop-monitor"],
216150
produces = ["application/json"],
217151
consumes = ["application/json"]
218152
)
219-
fun stopMonitorV1(@Parameter(description = "") @Valid @RequestBody(required = false) stopMonitorV1Request: StopMonitorV1Request?): ResponseEntity<StopMonitorV1Response> {
153+
fun stopMonitorV1( @Valid @RequestBody(required = false) stopMonitorV1Request: StopMonitorV1Request?): ResponseEntity<StopMonitorV1Response> {
220154
return ResponseEntity(service.stopMonitorV1(stopMonitorV1Request), HttpStatus.valueOf(200))
221155
}
222156
}

packages/cactus-plugin-ledger-connector-corda/src/main-server/kotlin/gen/kotlin-spring/src/main/kotlin/org/hyperledger/cactus/plugin/ledger/connector/corda/server/impl/StateMonitorClientSession.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import net.corda.core.node.services.vault.DEFAULT_PAGE_NUM
66
import net.corda.core.node.services.vault.PageSpecification
77
import net.corda.core.node.services.vault.QueryCriteria
88
import net.corda.core.utilities.loggerFor
9-
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1ResponseTx
9+
import org.hyperledger.cactus.plugin.ledger.connector.corda.server.model.GetMonitorTransactionsV1ResponseTxInner
1010
import rx.Subscription
1111
import java.math.BigInteger
1212
import java.time.LocalDateTime
@@ -26,7 +26,7 @@ class StateMonitorClientSession(private val rpc: NodeRPCConnection, private val
2626
* Simple data class for monitor reactive `subscription`, and queue of `stateChanges` received from corda
2727
*/
2828
private data class StateMonitor(
29-
val stateChanges: MutableSet<GetMonitorTransactionsV1ResponseTx>,
29+
val stateChanges: MutableSet<GetMonitorTransactionsV1ResponseTxInner>,
3030
val subscription: Subscription
3131
)
3232

@@ -57,10 +57,10 @@ class StateMonitorClientSession(private val rpc: NodeRPCConnection, private val
5757
val stateUpdates = this.rpc.proxy.vaultTrackByWithPagingSpec(cordaState, criteria, pagingSpec).updates
5858

5959
var indexCounter = BigInteger.valueOf(0)
60-
val stateChanges = mutableSetOf<GetMonitorTransactionsV1ResponseTx>()
60+
val stateChanges = mutableSetOf<GetMonitorTransactionsV1ResponseTxInner>()
6161
val monitorSub = stateUpdates.subscribe { update ->
6262
update.produced.forEach { change ->
63-
val txResponse = GetMonitorTransactionsV1ResponseTx(indexCounter.toString(), change.toString())
63+
val txResponse = GetMonitorTransactionsV1ResponseTxInner(indexCounter.toString(), change.toString())
6464
indexCounter = indexCounter.add(BigInteger.valueOf(1))
6565
logger.debug("Pushing new transaction for state '{}', index {}", stateName, indexCounter)
6666
stateChanges.add(txResponse)
@@ -78,7 +78,7 @@ class StateMonitorClientSession(private val rpc: NodeRPCConnection, private val
7878
* @param stateName String representation of corda state to monitor.
7979
* @return Set of corda state changes
8080
*/
81-
fun getTransactions(stateName: String): MutableSet<GetMonitorTransactionsV1ResponseTx> {
81+
fun getTransactions(stateName: String): MutableSet<GetMonitorTransactionsV1ResponseTxInner> {
8282
if (!monitors.containsKey(stateName)) {
8383
throw Exception("No monitor running for corda state $stateName on requested client")
8484
}

0 commit comments

Comments
 (0)