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:
parent
2761f243ed
commit
3836732e2c
@ -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),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user