aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-08 06:03:52 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-08 06:03:52 +0800
commitf4c2fabbf8f8eccd5cd7c65035e78ad268a34b57 (patch)
tree853a661c245d5bdc1fb9d165aa204b7761bd91f2
parent0a616ad3b8b87c8142598b535154564cb9276cbe (diff)
downloaddexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.gz
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.bz2
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.lz
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.xz
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.tar.zst
dexon-sol-tools-f4c2fabbf8f8eccd5cd7c65035e78ad268a34b57.zip
Minor refactoring
-rw-r--r--packages/sra-api/src/api.ts3
-rw-r--r--packages/sra-api/src/examples/index.ts4
-rw-r--r--packages/sra-api/src/examples/relayerApiAssetDataPairsResponseSchema.ts21
-rw-r--r--packages/sra-api/src/responses.ts5
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,
},
},
},