Skip to content

Commit 31db4dc

Browse files
authored
Assorted fixes for the spec (#40)
1 parent 242cc27 commit 31db4dc

16 files changed

+116
-37
lines changed

docs/contributing/validation-rules-appendix.md

+38-15
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Reference: [Swagger OpenAPI Extensions](https://swagger.io/docs/specification/v3
7474
Users can define custom validations using vendor extensions (`x-custom-validation`), which allow adding extra constraints beyond standard OpenAPI rules.
7575

7676
Custom validations can be applied on:
77+
7778
1. Specific property
7879
2. Rules involving combinations of properties
7980

@@ -249,7 +250,7 @@ Verifies requiredFields must be specified if dependentField is not empty.
249250
x-custom-validation:
250251
dependentPresence:
251252
- dependentField: { { fieldname } }
252-
requiredFields:
253+
requiredFields:
253254
- { { fieldname } }
254255
- { { fieldname } }
255256
```
@@ -317,11 +318,11 @@ Verify at least one within a set of fields is required.
317318

318319
```yaml
319320
x-custom-validation:
320-
requireOneOf:
321-
- fields:
322-
- {{fieldname}}
323-
- {{fieldname}}
324-
message: 'Require at-least one of these fields.'
321+
requireOneOf:
322+
- fields:
323+
- { { fieldname } }
324+
- { { fieldname } }
325+
message: 'Require at-least one of these fields.'
325326
```
326327

327328
**Example:**
@@ -335,7 +336,6 @@ x-custom-validation:
335336
message: 'Require at-least one of these LPTokenOut or Amount.'
336337
```
337338

338-
339339
### **requireExactlyOne**
340340

341341
Verifies that exactly one field is present.
@@ -344,11 +344,11 @@ Verifies that exactly one field is present.
344344

345345
```yaml
346346
x-custom-validation:
347-
requireExactlyOne:
348-
- fields:
349-
- {{fieldname}}
350-
- {{fieldname}}
351-
message: 'Exactly one field must be present.'
347+
requireExactlyOne:
348+
- fields:
349+
- { { fieldname } }
350+
- { { fieldname } }
351+
message: 'Exactly one field must be present.'
352352
```
353353

354354
**Example:**
@@ -364,7 +364,6 @@ x-custom-validation:
364364
message: 'You must provide exactly one of Authorize, AuthorizeCredentials, Unauthorize, or UnauthorizeCredentials.'
365365
```
366366

367-
368367
### **conditionalRequiredOnFlag / conditionalForbiddenOnFlag**
369368

370369
Verifies a field must (must not) be set if a flag is set/not set.
@@ -384,7 +383,6 @@ conditionalRequiredOnFlag:
384383

385384
**Example (conditionalForbiddenOnFlag):**
386385

387-
388386
If asfAuthorizedNFTokenMinter is not set on SetFlag then NFTokenMinter field must be absent.
389387

390388
```yaml
@@ -416,7 +414,6 @@ conditionalGreaterThanOnFlag:
416414

417415
**Example (conditionalLessThanOnFlag):**
418416

419-
420417
If tfSellNFToken is set on Flags then Amount field must be less than 0.
421418

422419
```yaml
@@ -429,6 +426,32 @@ conditionalLessThanOnFlag:
429426
message: 'Must be less than 0.'
430427
```
431428

429+
### **flagConflict**
430+
431+
Verifies that only one flag in the list can be set.
432+
433+
**Structure:**
434+
435+
```yaml
436+
x-custom-validation:
437+
flagConflict:
438+
- flagField: Flags
439+
flags:
440+
- { { flag1 } }
441+
- { { flag2 } }
442+
```
443+
444+
**Example:**
445+
446+
```yaml
447+
x-custom-validation:
448+
flagConflict:
449+
- flagField: Flags
450+
flags:
451+
- tfMPTLock
452+
- tfMPTUnlock
453+
```
454+
432455
### **matchingCurrencyType**
433456

434457
Verifies two amount fields must be XRP-XRP or IOU-IOU.

shared/base.yaml

+15-2
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,23 @@ components:
221221
The XRP Ledger has two kinds of money: XRP, and issued currencies. Both types have high precision, although their
222222
formats are different.
223223
oneOf:
224-
- type: string
225-
description: 'XRP represented as a string.'
224+
- $ref: '#/components/schemas/XRP'
226225
- $ref: '#/components/schemas/IssuedCurrency'
227226

227+
XRP:
228+
$id: XRP
229+
properties:
230+
currency:
231+
type: string
232+
description: ^
233+
Specifies XRP as a currency, without a value. Normally, you will not use this
234+
model as it does not specify an amount of XRP. In cases where you need to
235+
specify an amount of XRP, you will use a string. However, for some book order
236+
requests where currencies are specified without amounts, you may need to
237+
specify the use of XRP, without a value. In these cases, you will use this
238+
object.
239+
default: XRP
240+
228241
IssuedCurrency:
229242
$id: IssuedCurrency
230243
type: object

shared/requests/submit.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ components:
114114
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
115115
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
116116
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
117+
OracleDelete: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
117118
oneOf:
118119
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
119120
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
@@ -161,6 +162,7 @@ components:
161162
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
162163
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
163164
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
165+
- $ref: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
164166
# TODO: Add other transaction types here
165167

166168
description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
@@ -223,6 +225,7 @@ components:
223225
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
224226
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
225227
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
228+
OracleDelete: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
226229
oneOf:
227230
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
228231
- $ref: '../transactions/oracle_set.yaml#/components/schemas/OracleSetTransaction'
@@ -270,6 +273,7 @@ components:
270273
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
271274
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
272275
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
276+
- $ref: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
273277
# TODO: Add other transaction types here
274278
description: 'Transaction definition in JSON format, optionally omitting any auto-fillable fields.'
275279
required:
@@ -353,6 +357,7 @@ components:
353357
AMMBid: '../transactions/amm_bid.yaml#/components/schemas/AMMBidTransaction'
354358
AMMCreate: '../transactions/amm_create.yaml#/components/schemas/AMMCreateTransaction'
355359
AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction'
360+
AMMDelete: '../transactions/amm_delete.yaml#/components/schemas/AMMDeleteTransaction'
356361
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
357362
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
358363
CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction'
@@ -391,6 +396,7 @@ components:
391396
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
392397
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
393398
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
399+
OracleDelete: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
394400
# TODO: Add other transaction types here
395401
oneOf:
396402
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
@@ -401,6 +407,7 @@ components:
401407
- $ref: '../transactions/amm_bid.yaml#/components/schemas/AMMBidTransaction'
402408
- $ref: '../transactions/amm_create.yaml#/components/schemas/AMMCreateTransaction'
403409
- $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction'
410+
- $ref: '../transactions/amm_delete.yaml#/components/schemas/AMMDeleteTransaction'
404411
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
405412
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
406413
- $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction'
@@ -439,6 +446,7 @@ components:
439446
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
440447
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
441448
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
449+
- $ref: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
442450
# TODO: Add other transaction types here
443451

444452
SubmitSuccessResponseV2:
@@ -458,6 +466,7 @@ components:
458466
AMMBid: '../transactions/amm_bid.yaml#/components/schemas/AMMBidTransaction'
459467
AMMCreate: '../transactions/amm_create.yaml#/components/schemas/AMMCreateTransaction'
460468
AMMDeposit: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction'
469+
AMMDelete: '../transactions/amm_delete.yaml#/components/schemas/AMMDeleteTransaction'
461470
AMMVote: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
462471
AMMWithdraw: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
463472
CredentialAccept: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction'
@@ -496,6 +505,7 @@ components:
496505
XChainCommit: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
497506
XChainCreateBridge: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
498507
XChainModifyBridge: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
508+
OracleDelete: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
499509
# TODO: Add other transaction types here
500510
oneOf:
501511
- $ref: '../transactions/payment.yaml#/components/schemas/PaymentTransaction'
@@ -506,6 +516,7 @@ components:
506516
- $ref: '../transactions/amm_bid.yaml#/components/schemas/AMMBidTransaction'
507517
- $ref: '../transactions/amm_create.yaml#/components/schemas/AMMCreateTransaction'
508518
- $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositTransaction'
519+
- $ref: '../transactions/amm_delete.yaml#/components/schemas/AMMDeleteTransaction'
509520
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteTransaction'
510521
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawTransaction'
511522
- $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptTransaction'
@@ -544,6 +555,7 @@ components:
544555
- $ref: '../transactions/xchain_commit.yaml#/components/schemas/XChainCommitTransaction'
545556
- $ref: '../transactions/xchain_create_bridge.yaml#/components/schemas/XChainCreateBridgeTransaction'
546557
- $ref: '../transactions/xchain_modify_bridge.yaml#/components/schemas/XChainModifyBridgeTransaction'
558+
- $ref: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteTransaction'
547559
# TODO: Add other transaction types here
548560

549561
SubmitErrorResponse:
@@ -557,6 +569,7 @@ components:
557569
- $ref: '../transactions/amm_bid.yaml#/components/schemas/AMMBidErrorCode'
558570
- $ref: '../transactions/amm_create.yaml#/components/schemas/AMMCreateErrorCode'
559571
- $ref: '../transactions/amm_deposit.yaml#/components/schemas/AMMDepositErrorCode'
572+
- $ref: '../transactions/amm_delete.yaml#/components/schemas/AMMDeleteErrorCode'
560573
- $ref: '../transactions/amm_vote.yaml#/components/schemas/AMMVoteErrorCode'
561574
- $ref: '../transactions/amm_withdraw.yaml#/components/schemas/AMMWithdrawErrorCode'
562575
- $ref: '../transactions/credential_accept.yaml#/components/schemas/CredentialAcceptErrorCode'
@@ -579,6 +592,7 @@ components:
579592
- $ref: '../transactions/nftoken_mint.yaml#/components/schemas/NFTokenMintErrorCode'
580593
- $ref: '../transactions/payment_channel_create.yaml#/components/schemas/PaymentChannelCreateErrorCode'
581594
- $ref: '../transactions/payment_channel_fund.yaml#/components/schemas/PaymentChannelFundErrorCode'
595+
- $ref: '../transactions/oracle_delete.yaml#/components/schemas/OracleDeleteErrorCode'
582596
- enum:
583597
- amendmentBlocked
584598
- highFee

shared/transactions/amm_bid.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ components:
1919
- Asset2
2020
properties:
2121
Asset:
22-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
22+
$ref: '../base.yaml#/components/schemas/Currency'
2323
description: |
2424
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
2525
with currency and issuer fields (omit issuer for XRP).
2626
Asset2:
27-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
27+
$ref: '../base.yaml#/components/schemas/Currency'
2828
description: |
2929
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
3030
with currency and issuer fields (omit issuer for XRP).

shared/transactions/amm_delete.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ components:
1818
- Asset2
1919
properties:
2020
Asset:
21-
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
21+
$ref: '../base.yaml#/components/schemas/Currency'
2222
description: |
2323
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
2424
with currency and issuer fields (omit issuer for XRP).
2525
Asset2:
26-
$ref: '../base.yaml#/components/schemas/CurrencyWithoutAmount'
26+
$ref: '../base.yaml#/components/schemas/Currency'
2727
description: |
2828
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
2929
with currency and issuer fields (omit issuer for XRP).

shared/transactions/amm_deposit.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ components:
1717
- Asset2
1818
properties:
1919
Asset:
20-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
20+
$ref: '../base.yaml#/components/schemas/Currency'
2121
description: |
2222
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
2323
with currency and issuer fields (omit issuer for XRP).
2424
Asset2:
25-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
25+
$ref: '../base.yaml#/components/schemas/Currency'
2626
description: |
2727
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
2828
with currency and issuer fields (omit issuer for XRP).

shared/transactions/amm_vote.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ components:
1515
- TradingFee
1616
properties:
1717
Asset:
18-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
18+
$ref: '../base.yaml#/components/schemas/Currency'
1919
description: |
2020
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
2121
with currency and issuer fields (omit issuer for XRP).
2222
Asset2:
23-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
23+
$ref: '../base.yaml#/components/schemas/Currency'
2424
description: |
2525
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
2626
with currency and issuer fields (omit issuer for XRP).

shared/transactions/amm_withdraw.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ components:
1313
- Asset2
1414
properties:
1515
Asset:
16-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
16+
$ref: '../base.yaml#/components/schemas/Currency'
1717
description: |
1818
(Required) The definition for one of the assets in the AMM's pool. In JSON, this is an object
1919
with currency and issuer fields (omit issuer for XRP).
2020
Asset2:
21-
$ref: '../base.yaml#/components/schemas/IssuedCurrency'
21+
$ref: '../base.yaml#/components/schemas/Currency'
2222
description: |
2323
(Required) The definition for the other asset in the AMM's pool. In JSON, this is an object
2424
with currency and issuer fields (omit issuer for XRP).

shared/transactions/credential_accept.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ components:
2020
Issuer:
2121
type: string
2222
description: The address of the issuer that created the credential.
23-
x-custom-validation:
24-
validCredentialType:
25-
field: CredentialType
2623

2724
CredentialAcceptErrorCode:
2825
$id: CredentialAcceptErrorCode

shared/transactions/credential_create.yaml

-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ components:
3535
description: |
3636
Arbitrary additional data about the credential, such as the URL where users can look up an associated Verifiable Credential document.
3737
If present, the minimum length is 1 byte and the maximum is 256 bytes.
38-
x-custom-validation:
39-
validCredentialType:
40-
field: CredentialType
4138
4239
CredentialCreateErrorCode:
4340
$id: CredentialCreateErrorCode

shared/transactions/credential_delete.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ components:
2828
- fields:
2929
- Subject
3030
- Issuer
31-
validCredentialType:
32-
field: CredentialType
3331

3432
CredentialDeleteErrorCode:
3533
$id: CredentialDeleteErrorCode

shared/transactions/deposit_preauth.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ components:
1717
type: array
1818
items:
1919
$ref: '#/components/schemas/AuthorizeCredentials'
20+
minItems: 1
21+
maxItems: 8
22+
uniqueItems: true
2023
description: |
2124
(Optional) A set of credentials to authorize. (Requires the Credentials amendment.)
2225
Unauthorize:
@@ -27,6 +30,9 @@ components:
2730
type: array
2831
items:
2932
$ref: '#/components/schemas/AuthorizeCredentials'
33+
minItems: 1
34+
maxItems: 8
35+
uniqueItems: true
3036
description: |
3137
(Optional) A set of credentials whose preauthorization should be revoked. (Requires the
3238
Credentials amendment.)

shared/transactions/did_set.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ components:
1313
Data:
1414
type: string
1515
format: hex
16+
maxLength: 256
1617
description: |
1718
(Optional) The public attestations of identity credentials associated with the DID.
1819
DIDDocument:
1920
type: string
2021
format: hex
22+
maxLength: 256
2123
description: |
2224
(Optional) The DID document associated with the DID.
2325
URI:
2426
type: string
2527
format: hex
28+
maxLength: 256
2629
description: |
2730
(Optional) The Universal Resource Identifier associated with the DID.
2831
x-custom-validation:

0 commit comments

Comments
 (0)