mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 10:16:32 -05:00
Merge pull request #708 from hedgedoc/feat/swagger-markdown-body
MarkdownBody: Register swagger metadata
This commit is contained in:
commit
432ebe1386
1 changed files with 14 additions and 0 deletions
|
@ -10,6 +10,7 @@ import {
|
||||||
ExecutionContext,
|
ExecutionContext,
|
||||||
InternalServerErrorException,
|
InternalServerErrorException,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
|
import { ApiBody, ApiConsumes } from '@nestjs/swagger';
|
||||||
import * as getRawBody from 'raw-body';
|
import * as getRawBody from 'raw-body';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,4 +38,17 @@ export const MarkdownBody = createParamDecorator(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
[
|
||||||
|
(target, key) => {
|
||||||
|
ApiConsumes('text/markdown')(
|
||||||
|
target,
|
||||||
|
key,
|
||||||
|
Object.getOwnPropertyDescriptor(target, key),
|
||||||
|
);
|
||||||
|
ApiBody({
|
||||||
|
required: true,
|
||||||
|
schema: { example: '# Markdown Body' },
|
||||||
|
})(target, key, Object.getOwnPropertyDescriptor(target, key));
|
||||||
|
},
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue