Skip to content

Commit e094010

Browse files
fix: openapi tests for besu, htlc-eth-besu and htlc-eth-besu-erc20
Changes endpoints getSingleStatus and getStatus in htlc-eth-besu and htlc-eth-besu-erc20 which now are of type post and defines for that new request schemas. Includes tests for all endpoints in besu, htlc-eth-besu and htlc-eth-besu-erc20, each of them with test cases: - Right request - Request including an invalid parameter - Request without a required parameter Closes hyperledger-cacti#1291 Relationed with hyperledger-cacti#847 Signed-off-by: Elena Izaguirre <[email protected]>
1 parent e2fc14f commit e094010

File tree

25 files changed

+2907
-492
lines changed

25 files changed

+2907
-492
lines changed

packages/cactus-plugin-htlc-eth-besu-erc20/src/main/json/openapi.json

+68-74
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,57 @@
191191
}
192192
}
193193
},
194+
"GetStatusRequest": {
195+
"description": "Defines the parameters for retrieving the status of the HTLC swap.",
196+
"required": [
197+
"ids",
198+
"web3SigningCredential",
199+
"connectorId",
200+
"keychainId"
201+
],
202+
"additionalProperties": false,
203+
"properties": {
204+
"ids": {
205+
"type": "array",
206+
"items": {
207+
"type": "string"
208+
}
209+
},
210+
"web3SigningCredential": {
211+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
212+
},
213+
"connectorId": {
214+
"type": "string"
215+
},
216+
"keychainId": {
217+
"type": "string"
218+
}
219+
}
220+
},
221+
"GetSingleStatusRequest": {
222+
"description": "Defines the parameters for retrieving the single status of the HTLC swap.",
223+
"required": [
224+
"id",
225+
"web3SigningCredential",
226+
"connectorId",
227+
"keychainId"
228+
],
229+
"additionalProperties": false,
230+
"properties": {
231+
"id": {
232+
"type": "string"
233+
},
234+
"web3SigningCredential": {
235+
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
236+
},
237+
"connectorId": {
238+
"type": "string"
239+
},
240+
"keychainId": {
241+
"type": "string"
242+
}
243+
}
244+
},
194245
"InitializeRequest": {
195246
"type": "object",
196247
"required": [
@@ -325,53 +376,23 @@
325376
}
326377
},
327378
"/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status": {
328-
"get": {
379+
"post": {
329380
"x-hyperledger-cactus": {
330381
"http": {
331-
"verbLowerCase": "get",
382+
"verbLowerCase": "post",
332383
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-status"
333384
}
334385
},
335386
"operationId": "getStatusV1",
336-
"summary": "Get array of status of a hashtimelock contract, the status are ( 0 - Invalid, 1 - Active, 2 - Refunded, 3 - Withdrawn, 4 - Expired)",
337-
"parameters": [
338-
{
339-
"name": "ids",
340-
"in": "query",
341-
"required": true,
342-
"schema": {
343-
"type": "array",
344-
"items": {
345-
"type": "string",
346-
"format": "bytes32"
387+
"requestBody": {
388+
"content": {
389+
"application/json": {
390+
"schema": {
391+
"$ref": "#/components/schemas/GetStatusRequest"
347392
}
348393
}
349-
},
350-
{
351-
"name": "web3SigningCredential",
352-
"in": "query",
353-
"required": true,
354-
"schema": {
355-
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
356-
}
357-
},
358-
{
359-
"name": "connectorId",
360-
"in": "query",
361-
"required": true,
362-
"schema": {
363-
"type": "string"
364-
}
365-
},
366-
{
367-
"name": "keychainId",
368-
"in": "query",
369-
"required": true,
370-
"schema": {
371-
"type": "string"
372-
}
373394
}
374-
],
395+
},
375396
"responses": {
376397
"200": {
377398
"description": "OK",
@@ -381,50 +402,23 @@
381402
}
382403
},
383404
"/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status": {
384-
"get": {
405+
"post": {
385406
"x-hyperledger-cactus": {
386407
"http": {
387-
"verbLowerCase": "get",
408+
"verbLowerCase": "post",
388409
"path": "/api/v1/plugins/@hyperledger/cactus-plugin-htlc-eth-besu-erc20/get-single-status"
389410
}
390411
},
391412
"operationId": "getSingleStatusV1",
392-
"summary": "Get a status of a hashtimelock contract, the status are ( 0 - Invalid, 1 - Active, 2 - Refunded, 3 - Withdrawn, 4 - Expired)",
393-
"parameters": [
394-
{
395-
"name": "id",
396-
"in": "query",
397-
"required": true,
398-
"schema": {
399-
"type": "string",
400-
"format": "bytes32"
401-
}
402-
},
403-
{
404-
"name": "web3SigningCredential",
405-
"in": "query",
406-
"required": true,
407-
"schema": {
408-
"$ref": "https://raw.githubusercontent.com/hyperledger/cactus/v0.8.0/packages/cactus-plugin-ledger-connector-besu/src/main/json/openapi.json#/components/schemas/Web3SigningCredential"
409-
}
410-
},
411-
{
412-
"name": "connectorId",
413-
"in": "query",
414-
"required": true,
415-
"schema": {
416-
"type": "string"
417-
}
418-
},
419-
{
420-
"name": "keychainId",
421-
"in": "query",
422-
"required": true,
423-
"schema": {
424-
"type": "string"
413+
"requestBody": {
414+
"content": {
415+
"application/json": {
416+
"schema": {
417+
"$ref": "#/components/schemas/GetSingleStatusRequest"
418+
}
425419
}
426420
}
427-
],
421+
},
428422
"responses": {
429423
"200": {
430424
"description": "OK",

0 commit comments

Comments
 (0)