Skip to content

Commit

Permalink
Add descriptions to JSON schemas and organize for documentation gener…
Browse files Browse the repository at this point in the history
…ation
  • Loading branch information
Chris Clark committed Nov 13, 2015
1 parent e267e41 commit 5a8e4be
Show file tree
Hide file tree
Showing 85 changed files with 1,051 additions and 389 deletions.
12 changes: 6 additions & 6 deletions src/common/schema-validator.js
Expand Up @@ -12,13 +12,15 @@ function loadSchemas() {
// listed explicitly for webpack (instead of scanning schemas directory)
const schemas = [
require('./schemas/objects/tx-json.json'),
require('./schemas/objects/tx-type.json'),
require('./schemas/objects/hash128.json'),
require('./schemas/objects/hash256.json'),
require('./schemas/objects/sequence.json'),
require('./schemas/objects/issue.json'),
require('./schemas/objects/ledgerversion.json'),
require('./schemas/objects/max-adjustment.json'),
require('./schemas/objects/memo.json'),
require('./schemas/objects/memos.json'),
require('./schemas/objects/uint32.json'),
require('./schemas/objects/value.json'),
require('./schemas/objects/source-adjustment.json'),
Expand All @@ -27,7 +29,8 @@ function loadSchemas() {
require('./schemas/objects/lax-amount.json'),
require('./schemas/objects/lax-lax-amount.json'),
require('./schemas/objects/min-adjustment.json'),
require('./schemas/objects/lax-adjustment.json'),
require('./schemas/objects/source-exact-adjustment.json'),
require('./schemas/objects/destination-exact-adjustment.json'),
require('./schemas/objects/tx-hash.json'),
require('./schemas/objects/address.json'),
require('./schemas/objects/adjustment.json'),
Expand Down Expand Up @@ -55,30 +58,27 @@ function loadSchemas() {
require('./schemas/output/get-balance-sheet'),
require('./schemas/output/get-ledger.json'),
require('./schemas/output/get-orderbook.json'),
require('./schemas/output/settings-transaction.json'),
require('./schemas/output/get-orders.json'),
require('./schemas/output/order-change.json'),
require('./schemas/output/order-cancellation-transaction.json'),
require('./schemas/output/prepare.json'),
require('./schemas/output/ledger-closed.json'),
require('./schemas/output/order-transaction.json'),
require('./schemas/output/get-paths.json'),
require('./schemas/output/trustline-transaction.json'),
require('./schemas/output/get-server-info.json'),
require('./schemas/output/get-settings.json'),
require('./schemas/output/orderbook-orders.json'),
require('./schemas/output/payment-transaction.json'),
require('./schemas/output/outcome.json'),
require('./schemas/output/get-transaction.json'),
require('./schemas/output/get-transactions.json'),
require('./schemas/output/get-trustlines.json'),
require('./schemas/input/get-balances.json'),
require('./schemas/input/get-balance-sheet.json'),
require('./schemas/input/get-ledger.json'),
require('./schemas/input/get-orders.json'),
require('./schemas/input/get-orderbook.json'),
require('./schemas/input/get-paths.json'),
require('./schemas/input/api-options.json'),
require('./schemas/input/get-settings.json'),
require('./schemas/input/get-account-info.json'),
require('./schemas/input/get-transaction.json'),
require('./schemas/input/get-transactions.json'),
require('./schemas/input/get-trustlines.json'),
Expand Down
5 changes: 4 additions & 1 deletion src/common/schemas/input/compute-ledger-hash.json
Expand Up @@ -3,7 +3,10 @@
"title": "computeLedgerHashParameters",
"type": "object",
"properties": {
"ledger": {"$ref": "getLedger"}
"ledger": {
"$ref": "getLedger",
"description": "The ledger header to hash."
}
},
"additionalProperties": false,
"required": ["ledger"]
Expand Down
24 changes: 24 additions & 0 deletions src/common/schemas/input/get-account-info.json
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "getAccountInfoParameters",
"description": "Parameters for getAccountInfo",
"type": "object",
"properties": {
"address": {
"$ref": "address",
"description": "The address of the account to get the account info of."
},
"options": {
"description": "Options that affect what to return.",
"properties": {
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Get the account info as of this historical ledger version."
}
},
"additionalProperties": false
}
},
"required": ["address"],
"additionalProperties": false
}
14 changes: 11 additions & 3 deletions src/common/schemas/input/get-balance-sheet.json
Expand Up @@ -4,16 +4,24 @@
"description": "Parameters for getBalanceSheet",
"type": "object",
"properties": {
"address": {"$ref": "address"},
"address": {
"$ref": "address",
"description": "The Ripple address of the account to get the balance sheet of."
},
"options": {
"properties": {
"excludeAddresses": {
"type": "array",
"items": {"$ref": "address"},
"uniqueItems": true
"uniqueItems": true,
"description": "Addresses to exclude from the balance totals."
},
"ledgerVersion": {"$ref": "ledgerVersion"}
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Get the balance sheet as of this historical ledger version."
}
},
"description": "Options to determine how the balances will be calculated.",
"additionalProperties": false
}
},
Expand Down
37 changes: 37 additions & 0 deletions src/common/schemas/input/get-balances.json
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "getBalancesParameters",
"description": "Parameters for getBalances",
"type": "object",
"properties": {
"address": {
"$ref": "address",
"description": "The address of the account to get balances for."
},
"options": {
"description": "Options to filter and determine which balances to return.",
"properties": {
"counterparty": {
"$ref": "address",
"description": "Only return balances with this counterparty."
},
"currency": {
"$ref": "currency",
"description": "Only return balances for this currency."
},
"limit": {
"type": "integer",
"minimum": 1,
"description": "Return at most this many balances."
},
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Return balances as they were in this historical ledger version."
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": ["address"]
}
21 changes: 17 additions & 4 deletions src/common/schemas/input/get-ledger.json
Expand Up @@ -5,11 +5,24 @@
"type": "object",
"properties": {
"options": {
"description": "Options affecting what ledger and how much data to return.",
"properties": {
"ledgerVersion": {"$ref": "ledgerVersion"},
"includeAllData": {"type": "boolean"},
"includeTransactions": {"type": "boolean"},
"includeState": {"type": "boolean"}
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Get ledger data for this historical ledger version."
},
"includeAllData": {
"type": "boolean",
"description": "Include full transactions and/or state information if `includeTransactions` and/or `includeState` is set."
},
"includeTransactions": {
"type": "boolean",
"description": "Return an array of hashes for each transaction or an array of all transactions that were validated in this ledger version, depending on whether `includeAllData` is set."
},
"includeState": {
"type": "boolean",
"description": "Return an array of hashes for all state data or an array of all state data in this ledger version, depending on whether `includeAllData` is set."
}
},
"additionalProperties": false
}
Expand Down
14 changes: 11 additions & 3 deletions src/common/schemas/input/get-orderbook.json
Expand Up @@ -8,14 +8,22 @@
"$ref": "address",
"description": "Address of an account to use as point-of-view. (This affects which unfunded offers are returned.)"
},
"orderbook": {"$ref": "orderbook"},
"orderbook": {
"$ref": "orderbook",
"description": "The order book to get."
},
"options": {
"description": "Options to determine what to return.",
"properties": {
"limit": {
"type": "integer",
"minimum": 1
"minimum": 1,
"description": "Return at most this many orders from the order book."
},
"ledgerVersion": {"$ref": "ledgerVersion"}
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Return the order book as of this historical ledger version."
}
},
"additionalProperties": false
}
Expand Down
14 changes: 11 additions & 3 deletions src/common/schemas/input/get-orders.json
Expand Up @@ -4,14 +4,22 @@
"description": "Parameters for getOrders",
"type": "object",
"properties": {
"address": {"$ref": "address"},
"address": {
"$ref": "address",
"description": "The Ripple address of the account to get open orders for."
},
"options": {
"description": "Options that determine what orders will be returned.",
"properties": {
"limit": {
"type": "integer",
"minimum": 1
"minimum": 1,
"description": "At most this many orders will be returned."
},
"ledgerVersion": {"$ref": "ledgerVersion"}
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Return orders as of this historical ledger version."
}
},
"additionalProperties": false
}
Expand Down
30 changes: 25 additions & 5 deletions src/common/schemas/input/get-paths.json
Expand Up @@ -4,19 +4,32 @@
"type": "object",
"properties": {
"pathfind": {
"description": "Specification of a pathfind request.",
"properties": {
"source": {
"description": "Properties of the source of funds.",
"type": "object",
"properties": {
"address": {"$ref": "address"},
"amount": {"$ref": "laxAmount"},
"address": {
"$ref": "address",
"description": "The Ripple address of the account where funds will come from."
},
"amount": {
"$ref": "laxAmount",
"description": "The amount of funds to send."
},
"currencies": {
"description": "An array of currencies (with optional counterparty) that may be used in the payment paths.",
"type": "array",
"items": {
"description": "A currency with optional counterparty.",
"type": "object",
"properties": {
"currency": {"$ref": "currency"},
"counterparty": {"$ref": "address"}
"counterparty": {
"$ref": "address",
"description": "The counterparty for the currency; if omitted any counterparty may be used."
}
},
"required": ["currency"],
"additionalProperties": false
Expand All @@ -31,10 +44,17 @@
"required": ["address"]
},
"destination": {
"description": "Properties of the destination of funds.",
"type": "object",
"properties": {
"address": {"$ref": "address"},
"amount": {"$ref": "laxLaxAmount"}
"address": {
"$ref": "address",
"description": "The address to send to."
},
"amount": {
"$ref": "laxLaxAmount",
"description": "The amount to be received by the receiver (`value` may be ommitted if a source amount is specified)."
}
},
"required": ["address", "amount"],
"additionalProperties": false
Expand Down
13 changes: 10 additions & 3 deletions src/common/schemas/input/get-settings.json
@@ -1,13 +1,20 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "getSettingsParameters",
"description": "Parameters for getSettings and getAccountInfo",
"description": "Parameters for getSettings",
"type": "object",
"properties": {
"address": {"$ref": "address"},
"address": {
"$ref": "address",
"description": "The address of the account to get the settings of."
},
"options": {
"description": "Options that affect what to return.",
"properties": {
"ledgerVersion": {"$ref": "ledgerVersion"}
"ledgerVersion": {
"$ref": "ledgerVersion",
"description": "Get the settings as of this historical ledger version."
}
},
"additionalProperties": false
}
Expand Down
15 changes: 11 additions & 4 deletions src/common/schemas/input/get-transaction.json
Expand Up @@ -4,15 +4,22 @@
"description": "Parameters for getTransaction",
"type": "object",
"properties": {
"identifier": {"$ref": "identifier"},
"id": {"$ref": "id"},
"options": {
"description": "Options to limit the ledger versions to search.",
"properties": {
"minLedgerVersion": {"$ref": "ledgerVersion"},
"maxLedgerVersion": {"$ref": "ledgerVersion"}
"minLedgerVersion": {
"$ref": "ledgerVersion",
"description": "The lowest ledger version to search."
},
"maxLedgerVersion": {
"$ref": "ledgerVersion",
"description": "The highest ledger version to search"
}
},
"additionalProperties": false
}
},
"additionalProperties": false,
"required": ["identifier"]
"required": ["id"]
}

0 comments on commit 5a8e4be

Please sign in to comment.