getodk / getodk/central

Additional XForm validation

Open
#260 3 comments 0 reactions 0 assignees View on GitHub
backend
Dominant language
JavaScript
Stars
226
Forks
235
Avg merge
2d 22h
Merged PRs (30d)
19

Description

Right now, if a user uploads an XLSForm, pyxform will validate it. One thing that pyxform will do is pass the resulting XForm to ODK Validate. However, if a user uploads an XForm, Central will complete only limited validation. The backend will use `htmlparser2` to parse the XML, but `htmlparser2` is a relatively forgiving parser that will tolerate some errors. The backend won't pass the XForm to ODK Validate. There would be benefits to additional validation of XForms:

- If there is a form error that ODK Validate would catch, the user would discover it sooner, before encountering an issue on the client
- It's hard to predict how a client would respond to the presence of XML errors. Collect and Enketo may respond differently to an XML error. It'd be better to catch any error at the time of form creation.
- We may be interested in using the Postgres `xml` data type in more cases. However, Postgres seems to be strict about XML validation, so that data type is only available for forms whose XML is well formed. If there was a guarantee that all new forms have well formed XML, it might feel safer to use the `xml` data type in more cases.

Probably what would be most useful would be to pass all XForms through ODK Validate. However, even just a basic check that the XML is well formed would be useful.

Whatever the new validation is, it should ensure continuity for servers that have already uploaded forms with XML that is not well formed. It should be possible for those servers to continue to use any form that has already been uploaded, to upgrade to new versions of Central, and to restore database backups.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.