Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
chore(swagger): add components for response types
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Nov 30, 2023
1 parent 8dcbd08 commit cf27d27
Showing 1 changed file with 64 additions and 24 deletions.
88 changes: 64 additions & 24 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,28 @@ components:
description: Evaluate the contract at up to a specific sort key. Only applicable if blockHeight is not provided.
schema:
type: string
responses:
BadRequest:
description: Invalid request.
content:
application/json:
schema:
type: string
example: 'Invalid block height, must be a single integer'
NotFound:
description: The requested resource was not found.
content:
application/json:
schema:
type: string
example: 'Contract not found'
InternalServerError:
description: An internal server error occurred.
content:
application/json:
schema:
type: string
example: 'Internal server error'
schemas:
ArNsContractState:
type: object
Expand Down Expand Up @@ -135,11 +157,11 @@ paths:
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
description: Bad request if query parameters are invalid.
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/read/{functionName}:
get:
Expand Down Expand Up @@ -172,9 +194,11 @@ paths:
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
description: Bad request if query parameters are missing or invalid.
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/price:
get:
Expand Down Expand Up @@ -234,9 +258,11 @@ paths:
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
description: Bad request if query parameters are missing or invalid.
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/{field}:
get:
Expand Down Expand Up @@ -265,10 +291,12 @@ paths:
example: '000001301946,0000000000000,d2efe5278648460ed160e1d8a28fb86ab686e36cf14a3321d0a2b10c6851ea99'
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/records:
get:
Expand Down Expand Up @@ -314,10 +342,12 @@ paths:
example: '000001301946,0000000000000,d2efe5278648460ed160e1d8a28fb86ab686e36cf14a3321d0a2b10c6851ea99'
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/records/{name}:
get:
Expand Down Expand Up @@ -367,10 +397,12 @@ paths:
example: '000001301946,0000000000000,d2efe5278648460ed160e1d8a28fb86ab686e36cf14a3321d0a2b10c6851ea99'
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Record does not exist in the contract.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/balances/{walletAddress}:
get:
Expand Down Expand Up @@ -402,10 +434,12 @@ paths:
example: '000001301946,0000000000000,d2efe5278648460ed160e1d8a28fb86ab686e36cf14a3321d0a2b10c6851ea99'
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Wallet does not have a balance in the contract.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/interactions:
get:
Expand Down Expand Up @@ -434,11 +468,11 @@ paths:
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
description: Bad request if query parameters are invalid.
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/contract/{contractTxId}/interactions/{walletAddress}:
get:
Expand Down Expand Up @@ -483,10 +517,12 @@ paths:
example: '000001301946,0000000000000,d2efe5278648460ed160e1d8a28fb86ab686e36cf14a3321d0a2b10c6851ea99'
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Contract not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/wallet/{walletAddress}/contracts:
get:
Expand Down Expand Up @@ -527,10 +563,12 @@ paths:
'-tYkDvWQKiJF8TZTKX3ccRY8Nx7rIh21r1UNbrXAB38',
'GmFuXgBgtXHgVf1RJtgAyuZyDx3OfRn-HXzdDGlrFe0',
]
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Wallet not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

/wallet/{address}/contract/{contractTxId}:
get:
Expand Down Expand Up @@ -583,7 +621,9 @@ paths:
]
evaluationOptions:
$ref: '#/components/schemas/EvaluationOptions'
'400':
$ref: '#/components/responses/BadRequest'
'404':
description: Wallet not found.
$ref: '#/components/responses/NotFound'
'503':
description: Internal server error.
$ref: '#/components/responses/InternalServerError'

0 comments on commit cf27d27

Please sign in to comment.