cardano-foundation / cardano-foundation/cardano-rosetta-java
Document and validate related_operations usage
- Dominant language
- Java
- Stars
- 26
- Forks
- 15
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 2
Description
### Context & versions
cardano-rosetta-java 1.3.x - Several API endpoints
### Problem
The `related_operations` field usage is not clearly documented. The implementation uses an n→m pattern (each output references all inputs that fund it), but this isn't explained in the documentation.
### Current behavior
Each output operation references all input operations:
```json
{
"operation_identifier": {"index": 4, "network_index": 0},
"related_operations": [
{"index": 0}, // References input at index 0
{"index": 1}, // ...
{"index": 2},
{"index": 3}
],
"type": "output",
"account": {"address": "addr_test1..."},
"amount": {"value": "2000000", "currency": {"symbol": "ADA", "decimals": 6}}
}
```
### Expected behavior
1. Clear documentation of the n→m pattern being used
2. Validation that references only point to earlier indices (DAG requirement)
3. Examples showing the relationship pattern in documentation
### Tasks
- [ ] Document the n→m pattern in API documentation
- [ ] Add examples showing how outputs reference inputs
- [ ] Implement validation to ensure DAG structure (references only to earlier indices)
- [ ] Update test cases to verify related_operations consistency
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.