forked from apxtri/apxtri
modif checkjson to remove unknow propertie at check data
This commit is contained in:
parent
305e3c2645
commit
3b09756601
@ -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) => {
|
||||||
|
@ -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){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user