WIP joi validation for impose

This commit is contained in:
Felix Kaspar
2023-11-27 23:35:18 +01:00
parent 09aa3a8bc9
commit ba2588ea24
7 changed files with 154 additions and 115 deletions

View File

@@ -1,7 +1,7 @@
import Joi from 'joi';
import { PDFPage } from 'pdf-lib';
import { PdfFile, RepresentationType, PdfFileSchema } from '../wrappers/PdfFile';
import { PdfFile, RepresentationType, JoiPdfFileSchema } from '../wrappers/PdfFile';
const whSchema = Joi.string().custom((value, helpers) => {
console.log("value.pageSize", typeof value)
@@ -23,7 +23,7 @@ const whSchema = Joi.string().custom((value, helpers) => {
});
export const ScalePageSchema = Joi.object({
file: PdfFileSchema.required(),
file: JoiPdfFileSchema.required(),
pageSize: Joi.alternatives().try(whSchema, Joi.array().items(whSchema)).required(),
});