blob: cd7352058a0125b6d54c2880e178419874997a58 (
plain) (
tree)
|
|
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;
};
|