aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sra-api')
-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,
},
},
},