Workflow and API validation for input file types
(still needs to be ckecked if a pdf is valid)
This commit is contained in:
@@ -99,9 +99,9 @@ export class Impose extends Operator {
|
||||
protected static outputSchema = JoiPDFFileSchema.label(translationObject.outputs.pdfFile.name).description(translationObject.outputs.pdfFile.description);
|
||||
|
||||
static schema = Joi.object({
|
||||
input: Impose.inputSchema.required(),
|
||||
input: Impose.inputSchema,
|
||||
values: Impose.valueSchema.required(),
|
||||
output: Impose.outputSchema.optional()
|
||||
output: Impose.outputSchema
|
||||
}).label(translationObject.operators.nup.friendlyName).description(translationObject.operators.nup.description);
|
||||
|
||||
|
||||
@@ -141,19 +141,4 @@ export class Impose extends Operator {
|
||||
return result;
|
||||
})
|
||||
}
|
||||
|
||||
validate(): { valid: boolean; reason?: string | undefined; } {
|
||||
let baseValidationResults = super.validate();
|
||||
if(!baseValidationResults.valid)
|
||||
return baseValidationResults;
|
||||
|
||||
// TODO: Fully integrate joi in the base and remove this func
|
||||
|
||||
this.actionValues = Impose.valueSchema.validate(this.actionValues);
|
||||
|
||||
if(this.actionValues.error)
|
||||
return { valid: false, reason: this.actionValues }
|
||||
|
||||
return { valid: true }
|
||||
}
|
||||
}
|
||||
@@ -22,9 +22,9 @@ export class Operator {
|
||||
protected static valueSchema: Joi.Schema;
|
||||
protected static outputSchema: Joi.Schema;
|
||||
static schema: Joi.ObjectSchema<{
|
||||
input: Joi.Schema;
|
||||
values: Joi.Schema;
|
||||
output: Joi.Schema;
|
||||
input: any;
|
||||
values: any;
|
||||
output: any;
|
||||
}>;
|
||||
|
||||
actionValues: any;
|
||||
@@ -36,13 +36,6 @@ export class Operator {
|
||||
async run(input: any[], progressCallback: (progress: Progress) => void): Promise<any[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
validate(): ValidationResult {
|
||||
if(!this.actionValues) {
|
||||
return { valid: false, reason: "The Operators action values were empty."}
|
||||
}
|
||||
return { valid: true };
|
||||
}
|
||||
}
|
||||
|
||||
/** This function should be used if the Operation may take multiple files as inputs and only outputs one file */
|
||||
|
||||
Reference in New Issue
Block a user