aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sra-api/src/responses.ts
blob: 03a0cced87195ac7aee4c56c60405a9db78838fc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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: {
            'application/json': {
                schema: { $ref: `#/components/schemas/${schemaName}` },
                example,
            },
        },
    },
    ...errorResponses,
});