1
0
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:
Gastón Fournier 2025-05-29 12:44:00 +02:00 committed by GitHub
parent 08e6c77d9c
commit 600ee7ee80
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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: