aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-spec/src/responses.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-27 22:28:57 +0800
committerFabio Berger <me@fabioberger.com>2018-08-27 22:28:57 +0800
commitb8241c0f808518a3f727424cacb952cc9ce80c4c (patch)
tree309abba264ea3578cefdc8d7a4f53ef482ff26c9 /packages/sra-spec/src/responses.ts
parentfe7a8be98c32c6aed8548574e67e36962db732fb (diff)
parentf4a4fefe422a5b2140d5bb394a7f06f842352c69 (diff)
downloaddexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar.gz
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar.bz2
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar.lz
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar.xz
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.tar.zst
dexon-sol-tools-b8241c0f808518a3f727424cacb952cc9ce80c4c.zip
Merge branch 'development' into dev-dropdown
* development: (120 commits) Exit with non-error code at end of publishRelease Publish Updated CHANGELOGS Fix prettier Update changelog files for RC packages Skip doc generation for local publishes since we test this in a separate CI test Fix typo Use absolute path Run yarn a second time if the first fails Try relative to root dir Fix command Move md files to lib folder during build Change exit code to failure Fix sra-spec `main` and `types` in package.json Actual relative path Try relative path Issue #1025 BlockParam unroll Fix command Move md files to lib folder during build Fix sra-spec `main` and `types` in package.json ...
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;
+};