mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
refactor: revert json schema changes
This commit is contained in:
@@ -22,17 +22,17 @@ import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-lar
|
||||
import {SCSyntaxErrorResponse} from '../errors/syntax-error.js';
|
||||
import {SCUnsupportedMediaTypeErrorResponse} from '../errors/unsupported-media-type.js';
|
||||
import {SCValidationErrorResponse} from '../errors/validation.js';
|
||||
import {SCRoute, SCRouteHttpVerbs} from '../route.js';
|
||||
import {default as indexRequestSchema} from 'schema:#SCIndexRequest';
|
||||
import {default as indexResponseSchema} from 'schema:#SCIndexResponse';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
|
||||
|
||||
/**
|
||||
* Index request
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCIndexRequest {}
|
||||
|
||||
/**
|
||||
* A response to an index request
|
||||
* @validatable
|
||||
*/
|
||||
export interface SCIndexResponse {
|
||||
/**
|
||||
@@ -54,20 +54,21 @@ export interface SCIndexResponse {
|
||||
/**
|
||||
* Route to request meta information about the deployment
|
||||
*/
|
||||
export type SCIndexRoute = typeof indexRoute;
|
||||
|
||||
export const indexRoute = Object.freeze({
|
||||
errors: [
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
SCUnsupportedMediaTypeErrorResponse,
|
||||
SCValidationErrorResponse,
|
||||
] as const,
|
||||
method: SCRouteHttpVerbs.POST,
|
||||
requestBodySchema: indexRequestSchema,
|
||||
responseBodySchema: indexResponseSchema,
|
||||
statusCodeSuccess: StatusCodes.OK,
|
||||
urlPath: '/',
|
||||
}) satisfies Readonly<SCRoute>;
|
||||
export class SCIndexRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
SCUnsupportedMediaTypeErrorResponse,
|
||||
SCValidationErrorResponse,
|
||||
];
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCIndexRequest';
|
||||
this.responseBodyName = 'SCIndexResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,11 @@ import {SCPluginAlreadyRegisteredErrorResponse} from '../errors/plugin-already-r
|
||||
import {SCPluginRegisteringFailedErrorResponse} from '../errors/plugin-registering-failed.js';
|
||||
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large.js';
|
||||
import {SCSyntaxErrorResponse} from '../errors/syntax-error.js';
|
||||
import {SCRoute, SCRouteHttpVerbs} from '../route.js';
|
||||
import {default as pluginRegisterRequestSchema} from 'schema:#SCPluginRegisterRequest';
|
||||
import {default as pluginRegisterResponseSchema} from 'schema:#SCPluginRegisterResponse';
|
||||
import {SCAbstractRoute, SCRouteHttpVerbs} from '../route.js';
|
||||
|
||||
/**
|
||||
* Plugin register request
|
||||
* @validatable
|
||||
*/
|
||||
export type SCPluginRegisterRequest = SCPluginAdd | SCPluginRemove;
|
||||
|
||||
@@ -97,6 +96,7 @@ export interface SCPluginMetaData {
|
||||
export interface SCPluginRegisterResponse {
|
||||
/**
|
||||
* Whether the desired action succeeded or failed (true for success, false if an error occurred)
|
||||
* @validatable
|
||||
*/
|
||||
success: boolean;
|
||||
}
|
||||
@@ -104,22 +104,23 @@ export interface SCPluginRegisterResponse {
|
||||
/**
|
||||
* Route to register plugins
|
||||
*/
|
||||
export type SCPluginRegisterRoute = typeof pluginRegisterRoute;
|
||||
|
||||
export const pluginRegisterRoute = Object.freeze({
|
||||
errors: [
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCNotFoundErrorResponse,
|
||||
SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
],
|
||||
method: SCRouteHttpVerbs.POST,
|
||||
requestBodySchema: pluginRegisterRequestSchema,
|
||||
responseBodySchema: pluginRegisterResponseSchema,
|
||||
statusCodeSuccess: StatusCodes.OK,
|
||||
urlPath: '/plugin/register',
|
||||
}) satisfies Readonly<SCRoute>;
|
||||
export class SCPluginRegisterRoute extends SCAbstractRoute {
|
||||
constructor() {
|
||||
super();
|
||||
this.errorNames = [
|
||||
SCInternalServerErrorResponse,
|
||||
SCMethodNotAllowedErrorResponse,
|
||||
SCNotFoundErrorResponse,
|
||||
SCParametersNotAcceptable,
|
||||
SCPluginAlreadyRegisteredErrorResponse,
|
||||
SCPluginRegisteringFailedErrorResponse,
|
||||
SCRequestBodyTooLargeErrorResponse,
|
||||
SCSyntaxErrorResponse,
|
||||
];
|
||||
this.method = SCRouteHttpVerbs.POST;
|
||||
this.requestBodyName = 'SCPluginRegisterRequest';
|
||||
this.responseBodyName = 'SCPluginRegisterResponse';
|
||||
this.statusCodeSuccess = StatusCodes.OK;
|
||||
this.urlPath = '/plugin/register';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user