Skip to content

Commit f55189d

Browse files
committed
docs(V2): document referential integrity guards for remaining DELETE endpoints
Add Referential integrity notes and 409 response examples to validation, location, and project-methodology DELETE sections. Add Cascade delete notes and stagedChildDeletes to verification and issuance DELETE sections. Fix stale success message strings that said 'deletion' instead of 'delete'.
1 parent 0145e1a commit f55189d

1 file changed

Lines changed: 50 additions & 8 deletions

File tree

docs/cadt_rpc_api_v2.md

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,20 +2764,32 @@ Response
27642764

27652765
**Note**: The ID in the URL path is the `cadTrustValidationId`.
27662766

2767+
**Referential integrity**: If any committed or staged (`INSERT`/`UPDATE`) `verification` records reference this validation via `cadTrustValidationId`, the request returns `409 Conflict` until those references are removed. References from any synced registry count the same.
2768+
27672769
Request
27682770
```shell
27692771
curl --location --request DELETE 'localhost:31310/v2/validation/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \
27702772
--header 'Content-Type: application/json'
27712773
```
27722774

2773-
Response
2775+
Response (success — no references)
27742776
```json
27752777
{
2776-
"message": "Validation deletion staged successfully",
2778+
"message": "Validation delete staged successfully",
27772779
"success": true
27782780
}
27792781
```
27802782

2783+
Response (409 — references exist)
2784+
```json
2785+
{
2786+
"success": false,
2787+
"message": "Cannot delete validation: it is still referenced by 2 verifications. Remove those references before deleting this validation.",
2788+
"error": "Referenced records must be removed before deletion",
2789+
"references": [{ "table": "verification", "count": 2 }]
2790+
}
2791+
```
2792+
27812793
---
27822794

27832795
## `verification`
@@ -2937,6 +2949,8 @@ Response
29372949

29382950
**Note**: The ID in the URL path is the `cadTrustVerificationId`.
29392951

2952+
**Cascade delete**: Deleting a verification automatically stages DELETE entries for all child issuances and their units. The `stagedChildDeletes` field in the response reports the total number of child rows staged.
2953+
29402954
Request
29412955
```shell
29422956
curl --location --request DELETE 'localhost:31310/v2/verification/b2c3d4e5-f6a7-8901-bcde-f23456789012' \
@@ -2946,7 +2960,8 @@ curl --location --request DELETE 'localhost:31310/v2/verification/b2c3d4e5-f6a7-
29462960
Response
29472961
```json
29482962
{
2949-
"message": "Verification deletion staged successfully",
2963+
"message": "Verification delete staged successfully",
2964+
"stagedChildDeletes": 5,
29502965
"success": true
29512966
}
29522967
```
@@ -3110,20 +3125,32 @@ Response
31103125

31113126
**Note**: The ID in the URL path is the `cadTrustLocationId`.
31123127

3128+
**Referential integrity**: If any committed or staged (`INSERT`/`UPDATE`) `issuance` records reference this location via `cadTrustLocationId`, the request returns `409 Conflict` until those references are removed. References from any synced registry count the same.
3129+
31133130
Request
31143131
```shell
31153132
curl --location --request DELETE 'localhost:31310/v2/location/8182100d-7794-4df7-b3b3-758391d13011' \
31163133
--header 'Content-Type: application/json'
31173134
```
31183135

3119-
Response
3136+
Response (success — no references)
31203137
```json
31213138
{
3122-
"message": "Location deletion staged successfully",
3139+
"message": "Location deleted successfully",
31233140
"success": true
31243141
}
31253142
```
31263143

3144+
Response (409 — references exist)
3145+
```json
3146+
{
3147+
"success": false,
3148+
"message": "Cannot delete location: it is still referenced by 3 issuance records. Remove those references before deleting this location.",
3149+
"error": "Referenced records must be removed before deletion",
3150+
"references": [{ "table": "issuance", "count": 3 }]
3151+
}
3152+
```
3153+
31273154
---
31283155

31293156
## `issuance`
@@ -3276,6 +3303,8 @@ Response
32763303

32773304
**Note**: The ID in the URL path is the `cadTrustIssuanceId`.
32783305

3306+
**Cascade delete**: Deleting an issuance automatically stages DELETE entries for all child units and their unit labels. The `stagedChildDeletes` field in the response reports the total number of child rows staged.
3307+
32793308
Request
32803309
```shell
32813310
curl --location --request DELETE 'localhost:31310/v2/issuance/d9f58b08-af25-461c-88eb-403bb02b135e' \
@@ -3285,7 +3314,8 @@ curl --location --request DELETE 'localhost:31310/v2/issuance/d9f58b08-af25-461c
32853314
Response
32863315
```json
32873316
{
3288-
"message": "Issuance deletion staged successfully",
3317+
"message": "Issuance delete staged successfully",
3318+
"stagedChildDeletes": 3,
32893319
"success": true
32903320
}
32913321
```
@@ -4503,20 +4533,32 @@ Response
45034533

45044534
**Note**: The ID in the URL path is the `cadTrustProjectMethodologyId`.
45054535

4536+
**Referential integrity**: If any committed or staged (`INSERT`/`UPDATE`) `issuance` records reference this project-methodology link via `cadTrustProjectMethodologyId`, the request returns `409 Conflict` until those references are removed. References from any synced registry count the same.
4537+
45064538
Request
45074539
```shell
45084540
curl --location --request DELETE 'localhost:31310/v2/project-methodology/a1b2c3d4-e5f6-7890-abcd-ef1234567890' \
45094541
--header 'Content-Type: application/json'
45104542
```
45114543

4512-
Response
4544+
Response (success — no references)
45134545
```json
45144546
{
4515-
"message": "Project-Methodology relationship deletion staged successfully",
4547+
"message": "Project-Methodology relationship delete staged successfully",
45164548
"success": true
45174549
}
45184550
```
45194551

4552+
Response (409 — references exist)
4553+
```json
4554+
{
4555+
"success": false,
4556+
"message": "Cannot delete project-methodology relationship: it is still referenced by 2 issuance records. Remove those references before deleting this project-methodology relationship.",
4557+
"error": "Referenced records must be removed before deletion",
4558+
"references": [{ "table": "issuance", "count": 2 }]
4559+
}
4560+
```
4561+
45204562
---
45214563

45224564
## `stakeholder`

0 commit comments

Comments
 (0)