diff --git a/src/core/protocol/routes/plugin/PluginRegisterRequest.ts b/src/core/protocol/routes/plugin/PluginRegisterRequest.ts index 00a2c80c..0b64fd4b 100644 --- a/src/core/protocol/routes/plugin/PluginRegisterRequest.ts +++ b/src/core/protocol/routes/plugin/PluginRegisterRequest.ts @@ -29,40 +29,27 @@ import { * * @validatable */ -export type SCPluginRegisterRequest = AddPlugin | RemovePlugin; -interface AddPlugin { +export type SCPluginRegisterRequest = SCPluginAdd | SCPluginRemove; + +/** + * Plugin request for adding a plugin registration to the backend + */ +export interface SCPluginAdd { /** * The desired action, so whether the plugin should be added or removed */ action: 'add'; /** - * The address of the plugin + * Plugin information needed for its registration */ - address: string; - - /** - * The name of the plugin - * Just for debugging purposes, to more easily identify conflicts. - */ - name: string; - - /** - * How the requests of the plugin looks like, a JSON schema for validation - */ - pluginRequestSchema: Schema; - - /** - * How the responses of the plugin looks like, a JSON schema for validation - */ - pluginResponseSchema: Schema; - - /** - * The desired route, for example /feedback. - */ - route: string; + plugin: SCPluginMetaData; } -interface RemovePlugin { + +/** + * Plugin request for removing a plugin registration from the backend + */ +export interface SCPluginRemove { /** * The desired action, so whether the plugin should be added or removed */ @@ -74,6 +61,36 @@ interface RemovePlugin { route: string; } +/** + * Plugin meta data - contains needed information for a plugin registration + */ +export interface SCPluginMetaData { + /** + * The address of the plugin, to which the backend routes the requests + */ + address: string; + + /** + * The name of the plugin (for debugging purposes, to more easily identify conflicts) + */ + name: string; + + /** + * How the requests of the plugin looks like, a JSON schema for validation + */ + requestSchema: Schema; + + /** + * How the responses of the plugin looks like, a JSON schema for validation + */ + responseSchema: Schema; + + /** + * The desired route, for example /feedback. + */ + route: string; +} + /** * Route to register plugins */ @@ -85,7 +102,6 @@ export class SCPluginRegisterRoute extends SCAbstractRoute { SCMethodNotAllowedErrorResponse, SCParametersNotAcceptable, SCPluginAlreadyRegisteredErrorResponse, - SCPluginRouteAlreadyRegisteredErrorResponse, SCPluginRegisteringFailedErrorResponse, SCPluginRouteAlreadyRegisteredErrorResponse, SCRequestBodyTooLargeErrorResponse,