aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-spec/src/responses.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-08-25 04:38:30 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-08-25 04:38:30 +0800
commit44a430802e534f8b1eccb57ed87249925c32d4eb (patch)
treeec3ee9b35c231da47764bea7381f46fa6766b432 /packages/sra-spec/src/responses.ts
parent6b03cfd40d720096bf772c2966b1372c0e54bf51 (diff)
parent7f36574a57ced8ead0059b90673fe01f97f04827 (diff)
downloaddexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.gz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.bz2
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.lz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.xz
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.tar.zst
dexon-sol-tools-44a430802e534f8b1eccb57ed87249925c32d4eb.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into website/feature/react-16
Diffstat (limited to 'packages/sra-spec/src/responses.ts')
-rw-r--r--packages/sra-spec/src/responses.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/sra-spec/src/responses.ts b/packages/sra-spec/src/responses.ts
new file mode 100644
index 000000000..cd7352058
--- /dev/null
+++ b/packages/sra-spec/src/responses.ts
@@ -0,0 +1,24 @@
+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 => {
+ const responses = {
+ '200': {
+ headers,
+ description,
+ content: {},
+ },
+ ...errorResponses,
+ };
+ if (schemaName) {
+ responses['200'].content = {
+ 'application/json': {
+ schema: { $ref: `#/components/schemas/${schemaName}` },
+ example,
+ },
+ };
+ }
+ return responses;
+};