2023-07-29 18:10:00 +00:00
|
|
|
// For more information about this file see https://dove.feathersjs.com/guides/cli/validators.html
|
2023-07-29 21:50:42 +00:00
|
|
|
import { Ajv, addFormats } from "@feathersjs/schema";
|
|
|
|
import type { FormatsPluginOptions } from "@feathersjs/schema";
|
2023-07-29 18:10:00 +00:00
|
|
|
|
|
|
|
const formats: FormatsPluginOptions = [
|
2023-07-29 21:50:42 +00:00
|
|
|
"date-time",
|
|
|
|
"time",
|
|
|
|
"date",
|
|
|
|
"email",
|
|
|
|
"hostname",
|
|
|
|
"ipv4",
|
|
|
|
"ipv6",
|
|
|
|
"uri",
|
|
|
|
"uri-reference",
|
|
|
|
"uuid",
|
|
|
|
"uri-template",
|
|
|
|
"json-pointer",
|
|
|
|
"relative-json-pointer",
|
|
|
|
"regex",
|
|
|
|
];
|
2023-07-29 18:10:00 +00:00
|
|
|
|
2023-07-29 21:50:42 +00:00
|
|
|
export const dataValidator: Ajv = addFormats(new Ajv({}), formats);
|
2023-07-29 18:10:00 +00:00
|
|
|
|
|
|
|
export const queryValidator: Ajv = addFormats(
|
|
|
|
new Ajv({
|
2023-07-29 21:50:42 +00:00
|
|
|
coerceTypes: true,
|
2023-07-29 18:10:00 +00:00
|
|
|
}),
|
2023-07-29 21:50:42 +00:00
|
|
|
formats,
|
|
|
|
);
|