diff options
author | fragosti <francesco.agosti93@gmail.com> | 2018-08-08 08:58:38 +0800 |
---|---|---|
committer | fragosti <francesco.agosti93@gmail.com> | 2018-08-08 08:58:38 +0800 |
commit | 4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f (patch) | |
tree | 19fd0e5a8f86f0cd262c6e359fba90d224c8f1f5 /packages/sra-api/src/responses.ts | |
parent | 95b656f360f635447725e00bb90642f1b859477a (diff) | |
download | dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar.gz dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar.bz2 dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar.lz dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar.xz dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.tar.zst dexon-sol-tools-4e30bc3e16d7e0e8876fab09a61e9446c2c9d93f.zip |
Add POST order endpoint
Diffstat (limited to 'packages/sra-api/src/responses.ts')
-rw-r--r-- | packages/sra-api/src/responses.ts | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/packages/sra-api/src/responses.ts b/packages/sra-api/src/responses.ts index 03a0cced8..cd7352058 100644 --- a/packages/sra-api/src/responses.ts +++ b/packages/sra-api/src/responses.ts @@ -3,16 +3,22 @@ import { ResponsesObject } from '@loopback/openapi-v3-types'; import { errorResponses } from './errors'; import { headers } from './headers'; -export const generateResponses = (schemaName: string, example: any, description: string = 'OK'): ResponsesObject => ({ - '200': { - headers, - description, - content: { +export const generateResponses = (schemaName?: string, example?: any, description: string = 'OK'): ResponsesObject => { + const responses = { + '200': { + headers, + description, + content: {}, + }, + ...errorResponses, + }; + if (schemaName) { + responses['200'].content = { 'application/json': { schema: { $ref: `#/components/schemas/${schemaName}` }, example, }, - }, - }, - ...errorResponses, -}); + }; + } + return responses; +}; |