1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-15 17:50:48 +02:00

openapi: automate 404s

This commit is contained in:
Thomas Heartman 2023-08-17 08:38:58 +02:00
parent 2761f243ed
commit 3836732e2c
No known key found for this signature in database
GPG Key ID: BD1F880DAED1EE78
2 changed files with 5 additions and 7 deletions

View File

@ -18,10 +18,7 @@ import { OpenApiService } from '../../services/openapi-service';
import { AddonSchema, addonSchema } from '../../openapi/spec/addon-schema';
import { serializeDates } from '../../types/serialize-dates';
import { AddonsSchema, addonsSchema } from '../../openapi/spec/addons-schema';
import {
emptyResponse,
getStandardResponses,
} from '../../openapi/util/standard-responses';
import { emptyResponse } from '../../openapi/util/standard-responses';
import { AddonCreateUpdateSchema } from 'lib/openapi/spec/addon-create-update-schema';
type AddonServices = Pick<IUnleashServices, 'addonService' | 'openApiService'>;
@ -56,7 +53,6 @@ class AddonController extends Controller {
tags: ['Addons'],
operationId: 'getAddons',
responses: {
...getStandardResponses(401),
200: createResponseSchema('addonsSchema'),
},
},
@ -112,7 +108,6 @@ Note: passing \`null\` as a value for the description property will set it to an
requestBody: createRequestSchema('addonCreateUpdateSchema'),
responses: {
200: createResponseSchema('addonSchema'),
...getStandardResponses(404),
},
},
});
@ -131,7 +126,6 @@ Note: passing \`null\` as a value for the description property will set it to an
operationId: 'deleteAddon',
responses: {
200: emptyResponse,
...getStandardResponses(404),
},
},
});

View File

@ -129,6 +129,10 @@ export default class Controller {
errorCodes.add(415);
}
if (options.path.includes(':')) {
errorCodes.add(404);
}
if (options.permission !== NONE) {
errorCodes.add(403);
}