Skip to content

Commit

Permalink
feat: update api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed Sep 9, 2023
1 parent 15af344 commit feeb9ef
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 11 deletions.
69 changes: 60 additions & 9 deletions docs/api/spec/treetracker-wallet-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Treetracker Wallet API
contact: {}
version: '1.27.4'
version: '1.28.0'
servers:
- url: https://{environment}-k8s.treetracker.org/wallet/v2
variables:
Expand Down Expand Up @@ -85,13 +85,16 @@ paths:
- name: limit
in: query
description: Number of items to return
required: true
required: false
style: form
explode: true
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
example: 100
default: 2000
- name: offset
in: query
description: 'Where does the list offset, 0 means start from the beginning of the list'
Expand All @@ -101,6 +104,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 1
default: 0
- name: wallet
Expand Down Expand Up @@ -194,12 +198,15 @@ paths:
- name: limit
in: query
description: Number of items to return
required: true
required: false
style: form
explode: true
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
default: 1000
example: 100
- name: offset
in: query
Expand All @@ -210,6 +217,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 0
default: 0
responses:
Expand Down Expand Up @@ -252,12 +260,14 @@ paths:
- name: limit
in: query
description: 'Number of items to return'
required: true
required: false
style: form
explode: true
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
example: 100
default: 1000
- name: offset
Expand All @@ -269,6 +279,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 1
default: 0
responses:
Expand Down Expand Up @@ -408,6 +419,30 @@ paths:
type: string
format: uuid
example: 496ffa8e-2fa2-488c-98e1-acf9b57c230b
- name: state
in: query
description: 'Trust state'
required: false
style: form
explode: true
schema:
$ref: '#/components/schemas/trustStateType'
- name: type
in: query
description: 'Trust type'
required: false
style: form
explode: true
schema:
$ref: '#/components/schemas/trustType'
- name: request_type
in: query
description: 'Trust request type'
required: false
style: form
explode: true
schema:
$ref: '#/components/schemas/trustRequestType'
responses:
'200':
description: 'Return list of trust relationships for the wallet matching wallet_uuid'
Expand Down Expand Up @@ -507,7 +542,7 @@ paths:
explode: true
schema:
type: string
format: date
format: date-time
example: 2023-08-10
- name: after
in: query
Expand All @@ -517,19 +552,21 @@ paths:
explode: true
schema:
type: string
format: date
format: date-time
example: 2023-08-02
- name: limit
in: query
description: Number of items to return
required: true
required: false
style: form
explode: true
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
example: 100
default: 200
default: 1000
- name: offset
in: query
description: 'Where does the list offset, 0 means offset from the beginning of the list'
Expand All @@ -539,6 +576,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 1
default: 0
responses:
Expand Down Expand Up @@ -667,12 +705,15 @@ paths:
- name: limit
in: query
description: 'Number of items to return'
required: true
required: false
style: form
explode: true
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
default: 2000
example: 100
- name: offset
in: query
Expand All @@ -683,6 +724,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 0
default: 0
responses:
Expand Down Expand Up @@ -865,6 +907,9 @@ paths:
schema:
type: integer
format: int32
minimum: 1
maximum: 2000
default: 500
example: 100
- name: offset
in: query
Expand All @@ -875,6 +920,7 @@ paths:
schema:
type: integer
format: int32
minimum: 0
example: 0
default: 0
- name: state
Expand Down Expand Up @@ -1301,6 +1347,8 @@ components:
properties:
wallet:
type: string
minLength: 3
maxLength: 254
example:
wallet: sprinter_van_2004
walletsResponse:
Expand Down Expand Up @@ -1442,6 +1490,9 @@ components:
properties:
bundle_size:
type: integer
format: int32
minimum: 1
maximum: 10000
description: required number of trees to transfer
sender_wallet:
oneOf:
Expand Down
4 changes: 2 additions & 2 deletions server/handlers/walletHandler/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const TrustRelationshipEnums = require('../../utils/trust-enums');
const walletGetQuerySchema = Joi.object({
limit: Joi.number()
.integer().message('limit can only be non-negative integer')
.min(0).message('limit can only be non-negative integer')
.min(1).message('limit can only be non-negative integer')
.max(2000)
.default(1000),
offset: Joi.number()
Expand Down Expand Up @@ -33,7 +33,7 @@ const walletGetTrustRelationshipsSchema = Joi.object({
const walletPostSchema = Joi.object({
wallet: Joi.string()
.required()
.max(50)
.max(254)
.min(3)
.trim(true)
.regex(new RegExp('^[A-Za-z0-9-@.]+$'))
Expand Down

0 comments on commit feeb9ef

Please sign in to comment.