mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
feat: fail in dev when usign deprecated endpoints (#10058)
This commit is contained in:
parent
08e6c77d9c
commit
600ee7ee80
@ -51,6 +51,20 @@ export class OpenApiService {
|
|||||||
|
|
||||||
`
|
`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
|
const failDeprecated =
|
||||||
|
(op.deprecated ?? false) && process.env.NODE_ENV === 'development';
|
||||||
|
|
||||||
|
if (failDeprecated) {
|
||||||
|
return (req, res, next) => {
|
||||||
|
this.logger.warn(
|
||||||
|
`Deprecated endpoint: ${op.operationId} at ${req.path}`,
|
||||||
|
);
|
||||||
|
return res.status(410).json({
|
||||||
|
message: `The endpoint ${op.operationId} at ${req.path} is deprecated and should not be used.`,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
return this.api.validPath({
|
return this.api.validPath({
|
||||||
...rest,
|
...rest,
|
||||||
description:
|
description:
|
||||||
|
Loading…
Reference in New Issue
Block a user