Skip to content

Commit

Permalink
Documenting Account Responses stellar#2
Browse files Browse the repository at this point in the history
  • Loading branch information
Taylor-at-Stellar committed Sep 19, 2022
1 parent 18227da commit e64a461
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 36 deletions.
27 changes: 24 additions & 3 deletions openapi/components/endpoints/account.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# Notes:
# September 19:
# - investigate Hal Links
# - consult for response descriptions
# - skipping operations endpoint for now
paths:
/accounts:
get:
tags:
- account
summary: List all Accounts
description: "This endpoint lists accounts by one of three filters : signer, asset, or sponsor."
description: "This endpoint lists accounts by one of four filters : signer, asset, liquidity pool or sponsor."
operationId: ListAllAccounts
parameters:
- $ref: '../parameters.yml#/components/parameters/SponserParam'
Expand All @@ -16,7 +21,14 @@ paths:
- $ref: '../parameters.yml#/components/parameters/LimitParam'
responses:
'200':
description: OK
description: "Returns accounts based on provided filter: signer , asset, sponser or liquidity pool"
content:
application/json:
schema:
allOf:
- $ref: "../schemas/linksSchema.yml#/components/schemas/Links"
- $ref: "../schemas/accountLinkSchema.yml#/components/schemas/AccountLink"
- $ref: "../schemas/accountSchema.yml#/components/schemas/Account"
/accounts/{account_id}:
get:
tags:
Expand Down Expand Up @@ -51,7 +63,16 @@ paths:
- $ref: '../parameters.yml#/components/parameters/IncludeFailedParam'
responses:
'200':
description: OK
description: blank
content:
application/json:
schema:
allOf:
#TODO: 9/20 Compare results to Postman results, edit object as necessary
- $ref: "../schemas/linksSchema.yml#/components/schemas/Links"
- $ref: "../schemas/transactionLinkSchema.yml#/components/schemas/TransactionLink"
- $ref: "../schemas/transactionSchema.yml#/components/schemas/Transaction"

/accounts/{account_id}/operations:
get:
tags:
Expand Down
46 changes: 27 additions & 19 deletions openapi/components/schemas/accountLinkSchema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,33 @@ components:
AccountLink:
type: object
properties:
_links:
type: object
properties:
self:
$ref: '../instance_variables.yml#/components/schemas/link'
transactions:
$ref: '../instance_variables.yml#/components/schemas/link'
operations:
$ref: '../instance_variables.yml#/components/schemas/link'
payments:
$ref: '../instance_variables.yml#/components/schemas/link'
effects:
$ref: '../instance_variables.yml#/components/schemas/link'
offers:
$ref: '../instance_variables.yml#/components/schemas/link'
trades:
$ref: '../instance_variables.yml#/components/schemas/link'
data:
$ref: '../instance_variables.yml#/components/schemas/link'
_embedded:
type: object
properties:
records:
type: array
items:
type: object
properties:
_links:
type: object
properties:
self:
$ref: '../instance_variables.yml#/components/schemas/link'
transactions:
$ref: '../instance_variables.yml#/components/schemas/link'
operations:
$ref: '../instance_variables.yml#/components/schemas/link'
payments:
$ref: '../instance_variables.yml#/components/schemas/link'
effects:
$ref: '../instance_variables.yml#/components/schemas/link'
offers:
$ref: '../instance_variables.yml#/components/schemas/link'
trades:
$ref: '../instance_variables.yml#/components/schemas/link'
data:
$ref: '../instance_variables.yml#/components/schemas/link'
required:
- self
- transactions
Expand Down
18 changes: 18 additions & 0 deletions openapi/components/schemas/linksSchema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
components:
schemas:
Links:
type: object
properties:
_links:
type: object
properties:
self:
$ref: '../instance_variables.yml#/components/schemas/link'
next:
$ref: '../instance_variables.yml#/components/schemas/link'
prev:
$ref: '../instance_variables.yml#/components/schemas/link'
required:
- self
- next
- prev
31 changes: 31 additions & 0 deletions openapi/components/schemas/transactionLinkSchema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Sept 19: I have not determined how the links schema works in OpenApo
# yet, therefore I am not sure the links will stay in this format.
components:
schemas:
TransactionLink:
properties:
self:
$ref: '../instance_variables.yml#/components/schemas/link'
account:
$ref: '../instance_variables.yml#/components/schemas/link'
ledger:
$ref: '../instance_variables.yml#/components/schemas/link'
operations:
$ref: '../instance_variables.yml#/components/schemas/link'
effects:
$ref: '../instance_variables.yml#/components/schemas/link'
precedes:
$ref: '../instance_variables.yml#/components/schemas/link'
succeeds:
$ref: '../instance_variables.yml#/components/schemas/link'
transaction:
$ref: '../instance_variables.yml#/components/schemas/link'
required:
- self
- account
- ledger
- operations
- effects
- precedes
- succeeds
- transaction
26 changes: 12 additions & 14 deletions openapi/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ info:
version: 0.0.1

servers:
- url: https://horizon.stellar.org/
- url: https://horizon.stellar.org
description: The main network
- url: https://horizon-testnet.stellar.org/
- url: https://horizon-testnet.stellar.org
description: The test network
tags:
- name: account
Expand All @@ -16,23 +16,21 @@ tags:

paths:
/accounts:
$ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts'
$ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts'
/accounts/{account_id}:
$ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}'
$ref: '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}'
/accounts/{account_id}/transactions:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1transactions'
/accounts/{account_id}/operations:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1operations'
/accounts/{account_id}/payments:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1payments'
/accounts/{account_id}/effects:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1effects'
/accounts/{account_id}/offers:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1offers'
/accounts/{account_id}/trades:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades'
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1trades'
/accounts/{account_id}/data/{key}:
$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}'



$ref : '../openapi/components/endpoints/account.yml#/paths/~1accounts~1{account_id}~1data~1{key}'

1 change: 1 addition & 0 deletions redocly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ lint:
no-enum-type-mismatch: error
no-identical-paths: error
no-ambiguous-paths: error
security-defined: off

features.openapi:
generateCodeSamples:
Expand Down

0 comments on commit e64a461

Please sign in to comment.