grnet / djnro

DjNRO hits the decks of eduroam database management
http://djnro.grnet.gr/
Other
10 stars 21 forks source link

V2 Schema Validator failed for newly added institutes #77

Closed wakhan007 closed 4 years ago

wakhan007 commented 4 years ago

Hi, I have updated admintool from v1 to v2. After the update validator check was Okay. But when I add new institutes, the Validator check is failed with the below errors.

DOMDocument::schemaValidate() Generated Errors! Error 1871: Element 'contact': This element is not expected. Expected is one of ( inst_name, address ). in /data/www/monitor/eduroam-database/v2/scripts/ on line 1

DOMDocument::schemaValidate() Generated Errors! Error 1871: Element 'coordinates': This element is not expected. Expected is one of ( inst_name, address ). in /data/www/monitor/eduroam-database/v2/scripts/ on line 1

For Element 'coordinates' error, I changed the coordinates field in Institution details to '-----', as my old nodes, so this error is solved.

But for Element 'contact' error, this field cannot be set empty, as it is mandatory.

If I delete the newly added node in Institution Details, the Validator check is again Passed. So I think Coordinates and Contact filed in Institution Details is not required or has some issue.

zmousm commented 4 years ago

What should actually be noted here is that you are editing the data through Django admin. This does not perform the same validation as the edumanage forms or the parse_validation_xml management command. The latter properly enforce the requirements imposed by the eduroam database schema, namely that institutions have at least one address -- that is the problem hinted by the validator in your case, nothing to do with coordinates. So what you should have done is fill in the address data, namely provide at least one address in English (the latter is not imposed by the schema, although it is enforced by the validation mentioned previously).

I will look into adding such validation into the Django admin, it is quite tricky but it may be more doable nowadays (after the sweeping code refactoring in #70).

wakhan007 commented 4 years ago

the issue was solved by deleting and adding the new institution sites again .. Address field was defined before too , i dont know why it was not working before..

zmousm commented 4 years ago

In the XML you pointed to previously the address element was missing exactly where the validator showed this error. So I am pretty confident that was the problem.

In any case it would be nice if you could deploy the patch in #78 and test that a django admin input institution now gets validated properly as well.