mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
refactor: change modeling of obligatory parameters
This commit is contained in:
@@ -51,9 +51,9 @@ export interface SCRoute {
|
||||
method: SCRouteHttpVerbs;
|
||||
|
||||
/**
|
||||
* List of obligatory parameters that have to be set via the requested path
|
||||
* Map of obligatory parameters and their type that have to be set via the requested path
|
||||
*/
|
||||
obligatoryParameters?: string[];
|
||||
obligatoryParameters?: { [k: string]: string };
|
||||
|
||||
/**
|
||||
* Name of the type of the request body
|
||||
@@ -84,7 +84,7 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
'SCErrorResponse',
|
||||
];
|
||||
method: SCRouteHttpVerbs = 'GET';
|
||||
obligatoryParameters?: string[];
|
||||
obligatoryParameters?: { [k: string]: string };
|
||||
requestBodyName = 'any';
|
||||
responseBodyName = 'any';
|
||||
statusCodeSuccess = 200;
|
||||
@@ -97,8 +97,8 @@ export abstract class SCAbstractRoute implements SCRoute {
|
||||
|
||||
let obligatoryParameters: string[] = [];
|
||||
|
||||
if (Array.isArray(this.obligatoryParameters)) {
|
||||
obligatoryParameters = this.obligatoryParameters;
|
||||
if (typeof this.obligatoryParameters === 'object') {
|
||||
obligatoryParameters = Object.keys(this.obligatoryParameters);
|
||||
}
|
||||
|
||||
if (Object.keys(parameters).length > obligatoryParameters.length) {
|
||||
|
||||
Reference in New Issue
Block a user