mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +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({
|
||||
...rest,
|
||||
description:
|
||||
|
Loading…
Reference in New Issue
Block a user