Skip to content

feat(#804): var checks#805

Open
ChinHairSaintClair wants to merge 1 commit into
medic:mainfrom
ChinHairSaintClair:form-var-checks
Open

feat(#804): var checks#805
ChinHairSaintClair wants to merge 1 commit into
medic:mainfrom
ChinHairSaintClair:form-var-checks

Conversation

@ChinHairSaintClair
Copy link
Copy Markdown
Contributor

Description

Performs validation checks against form variables as configured through the related <form>.properties.json file.

The proposed structure:

{
  "var_restrictions": {
    "warn_length": <int>,
    "error_length": <int>,
    "ignore_list": <array>,
    "reserved_list": <array>
  }
}

Their functions:

  • warn_length: Print a warning with a list of vars whose length exceeds this limit
  • error_length: Throw an error with a list of vars whose length exceeds this limit
  • ignore_list: Exclude specified entries from either warning or error checks
  • reserved_list: Throw an error, with list of relevant items, if any reserved entries match form variables.

The feature also includes validation to guard against misconfiguration and surfaces these issues to the implementer. These include throwing an error if:

  • the warn_length or error_length contains any value other than a positive integer
  • the warn_length and error_length are the same
  • the ignore_list or reserved_list contain invalid values
  • there's any overlap between the ignore_list and reserverd_list

Issue: 804

Code review items

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or integration tests where appropriate
  • Backwards compatible: Works with existing data and configuration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants