diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-08 06:03:52 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-08 06:03:52 +0800 |
commit | f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57 (patch) | |
tree | 853a661c245d5bdc1fb9d165aa204b7761bd91f2 /packages/sra-api/src | |
parent | 0a616ad3b8b87c8142598b535154564cb9276cbe (diff) | |
download | dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.gz dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.zst dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.zip |
Minor refactoring
Diffstat (limited to 'packages/sra-api/src')
-rw-r--r-- | packages/sra-api/src/api.ts | 3 | ||||
-rw-r--r-- | packages/sra-api/src/examples/index.ts | 4 | ||||
-rw-r--r-- | packages/sra-api/src/examples/relayerApiAssetDataPairsResponseSchema.ts | 21 | ||||
-rw-r--r-- | packages/sra-api/src/responses.ts | 5 |
4 files changed, 7 insertions, 26 deletions
diff --git a/packages/sra-api/src/api.ts b/packages/sra-api/src/api.ts index 762d3f4d6..c93d57946 100644 --- a/packages/sra-api/src/api.ts +++ b/packages/sra-api/src/api.ts @@ -50,7 +50,8 @@ export const api: OpenApiSpec = { ), responses: generateResponses( 'relayerApiAssetDataPairsResponseSchema', - examples.relayerApiAssetDataPairsResponseSchema, + examples.relayerApiAssetDataPairsResponse, + `Returns a collection of available asset pairs with some meta info`, ), }, }, diff --git a/packages/sra-api/src/examples/index.ts b/packages/sra-api/src/examples/index.ts index eeeb353b3..a9d08691e 100644 --- a/packages/sra-api/src/examples/index.ts +++ b/packages/sra-api/src/examples/index.ts @@ -1,7 +1,7 @@ import { validationError } from './errors'; -import { relayerApiAssetDataPairsResponseSchema } from './relayerApiAssetDataPairsResponseSchema'; +import { relayerApiAssetDataPairsResponse } from './relayerApiAssetDataPairsResponse'; export const examples = { validationError, - relayerApiAssetDataPairsResponseSchema, + relayerApiAssetDataPairsResponse, }; diff --git a/packages/sra-api/src/examples/relayerApiAssetDataPairsResponseSchema.ts b/packages/sra-api/src/examples/relayerApiAssetDataPairsResponseSchema.ts deleted file mode 100644 index 89a0c82fb..000000000 --- a/packages/sra-api/src/examples/relayerApiAssetDataPairsResponseSchema.ts +++ /dev/null @@ -1,21 +0,0 @@ -export const relayerApiAssetDataPairsResponseSchema = { - total: 43, - page: 1, - perPage: 100, - records: [ - { - assetDataA: { - minAmount: '0', - maxAmount: '10000000000000000000', - precision: 5, - assetData: '0xf47261b04c32345ced77393b3530b1eed0f346429d', - }, - assetDataB: { - minAmount: '0', - maxAmount: '50000000000000000000', - precision: 5, - assetData: '0x0257179264389b814a946f3e92105513705ca6b990', - }, - }, - ], -}; diff --git a/packages/sra-api/src/responses.ts b/packages/sra-api/src/responses.ts index 59c679b9c..03a0cced8 100644 --- a/packages/sra-api/src/responses.ts +++ b/packages/sra-api/src/responses.ts @@ -3,13 +3,14 @@ import { ResponsesObject } from '@loopback/openapi-v3-types'; import { errorResponses } from './errors'; import { headers } from './headers'; -export const generateResponses = (schemaName: string, example: any): ResponsesObject => ({ +export const generateResponses = (schemaName: string, example: any, description: string = 'OK'): ResponsesObject => ({ '200': { headers, - description: 'OK', + description, content: { 'application/json': { schema: { $ref: `#/components/schemas/${schemaName}` }, + example, }, }, }, |