UNPKG

express-jsdoc-swagger

Version:
19 lines (15 loc) 456 B
const getSchema = require('./schema'); const DEFAULT_CONTENT_TYPE = 'application/json'; const getContent = entity => (type, contentType, originalValue, examples, extendSchema = {}) => { const schema = getSchema(entity, originalValue)(type); return { [contentType || DEFAULT_CONTENT_TYPE]: { schema: { ...schema, ...extendSchema, }, ...(examples ? { examples } : {}), }, }; }; module.exports = getContent;