mirror of
https://github.com/artegoser/AnoPaper.git
synced 2024-11-06 04:53:56 +03:00
15 lines
343 B
JavaScript
15 lines
343 B
JavaScript
const Ajv = require("ajv");
|
|
const ajv = new Ajv();
|
|
const note_schema = {
|
|
type: "object",
|
|
properties: {
|
|
name: { type: "string", maxLength: 64 },
|
|
text: { type: "string", maxLength: 5000 },
|
|
},
|
|
required: ["name", "text"],
|
|
additionalProperties: false,
|
|
};
|
|
|
|
module.exports = (data) => {
|
|
return ajv.validate(note_schema, data);
|
|
};
|