1
0
forked from apxtri/apxtri

modif checkjson to remove unknow propertie at check data

This commit is contained in:
philc 2024-09-10 16:40:27 +02:00
parent 305e3c2645
commit 3b09756601
2 changed files with 10 additions and 1 deletions

View File

@ -142,6 +142,9 @@ if (log) {
); );
} }
//Listen event file for each tribe
// @TODO à ajouter ici
app.listen(conf.api.port, () => { app.listen(conf.api.port, () => {
let webaccess = `api waits request on port:${conf.api.port} for`; let webaccess = `api waits request on port:${conf.api.port} for`;
conf.dns.forEach((u) => { conf.dns.forEach((u) => {

View File

@ -204,8 +204,14 @@ Checkjson.schema.data = (schema, data, withschemacheck) => {
// properties ={prop1:{type,format},prop2:{type:object,...}} // properties ={prop1:{type,format},prop2:{type:object,...}}
// subdata={prop1,prop2} // subdata={prop1,prop2}
// Return [] => no error, else 1 item per error {msg,ref:checkjson,data} // Return [] => no error, else 1 item per error {msg,ref:checkjson,data}
const propertielist=Object.keys(properties);
Object.keys(subdata).forEach(kdata=>{
if (!propertielist.includes(kdata)){
delete subdata[kdata];
}
})
let multimsg=[] let multimsg=[]
Object.keys(properties).forEach((p) => { propertielist.forEach((p) => {
//type is mandatory in a propertie //type is mandatory in a propertie
if (subdata[p]) { if (subdata[p]) {
if (properties[p].properties){ if (properties[p].properties){