XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
77 stars 134 forks source link

#669: reject form with unknown columns in entities sheet #671

Closed lindsay-stevens closed 7 months ago

lindsay-stevens commented 7 months ago

Closes #669

Why is this the best possible solution? Were any other approaches considered?

This adds to the existing entities validation in the parsing module. The approach is to create an enum with the allowed column names, and if any extra columns are found, raise an error naming the unexpected columns. I went through and updated internal string usages to reference the constants module to ensure that the keys are consistent (this typing could be done with a class but workbook_to_json emits a dict).

What are the regression risks?

Users may now get an error if they have already created forms where they have used annotation columns like those allowed in other XLSForm sheets. The Entities sheet is now "strict" in the sense that it only allows certain columns now.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

Probably not, the documentation would already say which columns are required / allowed.

Before submitting this PR, please make sure you have: