Skip to content

Commit

Permalink
cove_rdls/templates/cove_rdls/validation_table.html: Update error mes…
Browse files Browse the repository at this point in the history
…sages
  • Loading branch information
Ed (ODSC) committed Aug 23, 2023
1 parent 939a5e6 commit baf0ed4
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions cove_rdls/templates/cove_rdls/validation_table.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,56 @@
<tr>
<td>
<p>
{% if errors.0.validator == "required" %}
<strong><code>{{ errors.0.extra.required_key_which_is_missing }}</code> is missing but required. Check that the field is included and correctly spelled.</strong>
{% if errors.0.validator == "const" %}
<strong><code>{{ errors.0.path_ending}}</code> does not match constant specified in schema. The value must be {{ errors.0.validator_value }}.</strong>
{% elif errors.0.validator == "exclusiveMinimum" %}
<strong><code>{{ errors.0.path_ending}}</code> is less than or equal to the mininum value of {{ errors.0.validator_value }}.</strong>
{% elif errors.0.validator == "required" %}
<strong><code>Required field {{ errors.0.extra.required_key_which_is_missing }}</code> is missing. Your data must contain the required fields specified in the schema. Check that the field is present and not mispelled.</strong>
{% elif errors.0.validator == "maximum" %}
<strong><code>{{ errors.0.path_ending }}</code> is too large. The maximum allowed value is {{ errors.0.validator_value }}.</strong>
<strong><code>{{ errors.0.path_ending}}</code> is greater than the maximum value of {{ errors.0.validator_value }}.</strong>
{% elif errors.0.validator == "minimum" %}
<strong><code>{{ errors.0.path_ending}}</code> is too small. The minimum allowed value is {{ errors.0.validator_value }}.</strong>
<strong><code>{{ errors.0.path_ending}}</code> is less than the mininum value of {{ errors.0.validator_value }}.</strong>
{% elif errors.0.validator == "minItems" and errors.0.validator_value == 1 %}
<strong><code>{{ errors.0.path_ending}}</code> is an empty array. Fields with no value must be omitted in their entirety (key and value).</strong>
{% elif errors.0.validator == "minItems" and errors.0.validator_value > 1 %}
<strong><code>{{ errors.0.path_ending}}</code> has fewer than the minimum number of items. <code>{{ errors.0.path_ending}}</code> must have at least {{ errors.0.validator_value }} items. </strong>
{% elif errors.0.validator == "maxItems" %}
<strong><code>{{ errors.0.path_ending}}</code> has greater than the maximum number of items. <code>{{ errors.0.path_ending}}</code> must have no more than {{ errors.0.validator_value }} items. </strong>
{% elif errors.0.validator == "uniqueItems" %}
<strong><code>{{ errors.0.path_ending}}</code> has non-unique items. The items in <code>{{ errors.0.path_ending}}</code> must be unique.</strong>
{% elif errors.0.validator == "enum" %}
<strong><code>{{ errors.0.path_ending }}</code> contains an unrecognised value. Check the related codelist for allowed code values.</strong>
{% elif errors.0.validator == "pattern" %}
<strong><code>{{ errors.0.path_ending }}</code> does not match the regex <code>{{ errors.0.validator_value }}</code></strong>
<strong><code>{{ errors.0.path_ending }}</code> does not match any code. <code>{{ errors.0.path_ending }}</code> must match a code from the codelist specified in the schema.</strong>
{% elif errors.0.validator == "pattern" and len(errors.0.path) > 2 and errors.0.path[-2] == "Link" and errors.0.path[-1] == "rel" %}
<strong><code>{{ errors.0.path_ending }}</code> does not match the regex <code>{{ errors.0.validator_value }}</code>. With the exception of the first item in the <code>links</code> array, the value of <code>{{ errors.0.path_ending }}</code> must not be 'describedby'.</code></strong>
{% elif errors.0.validator == "format" and errors.0.validator_value == "date" %}
<strong>Date is not in the correct format. The correct format is YYYY-MM-DD.</strong>
<strong><code>{{ errors.0.path_ending }}</code> is not a date. Date values must be provided in <code>YYYY-MM-DD</code> format.</strong>
{% elif errors.0.validator == "format" and errors.0.validator_value == "iri" %}
<strong><code>{{ errors.0.path_ending }}</code> is not an IRI. IRI values must be formatted according to <a href="https://datatracker.ietf.org/doc/html/rfc3987">RFC3987</a>.</strong>
{% elif errors.0.validator == "format" and errors.0.validator_value == "date-time" %}
<strong>Date is not in the correct format. The correct format is YYYY-MM-DDT00:00:00Z.</strong>
{% elif errors.0.validator == "format" and errors.0.validator_value == "uri" %}
<strong>Invalid uri found</strong>
{% elif errors.0.validator == "minLength" %}
<strong><code>{{ errors.0.path_ending }}</code> is too short. It should be at least {{ errors.0.validator_value }} characters.</strong>
<strong><code>{{ errors.0.path_ending }}</code> is an empty string. Fields with no value must be omitted in their entirety (key and value).</strong>
{% elif errors.0.validator == "maxLength" %}
<strong><code>{{ errors.0.path_ending }}</code> is too long. It should not exceed {{ errors.0.validator_value }} characters.</strong>
{% elif errors.0.validator == "type" and errors.0.validator_value == "number" %}
<strong><code>{{ errors.0.path_ending }}</code> should be a number. Check that the value is not null, and doesn’t contain any characters other than 0-9 and dot (<code>.</code>). Number values should not be in quotes.</strong>
<strong><code>{{ errors.0.path_ending }}</code> is not a number. Number values must contain only digits (<code>0-9</code>) and, optionally, the dot character (<code>.</code>). Numbers must not be enclosed in quote characters, e.g. <code>1</code> is an number, but <code>"1"</code> is a string.</strong>
{% elif errors.0.validator == "type" and errors.0.validator_value == "array" %}
<strong><code>{{ errors.0.path_ending }}</code> should be a JSON array. Check that value(s) appear within square brackets, [...]</strong>
<strong><code>{{ errors.0.path_ending }}</code> is not an array. Array values must be enclosed in square brackets (<code>[</code> and <code>]</code>.</strong>
{% elif errors.0.validator == "type" and errors.0.validator_value == "string" %}
<strong><code>{{ errors.0.path_ending }}</code> should be a string. Check that the value is not null, and has quotes at the start and end. Escape any quotes in the value with <code>\</code></strong>
<strong><code>{{ errors.0.path_ending }}</code> is not a string. String values must begin and end with the quote character (<code>"</code>) and any quotes within the value must be escaped with a backslash (<code>\</code>).</strong>
{% elif errors.0.validator == "type" and errors.0.validator_value == "boolean" %}
<strong><code>{{ errors.0.path_ending }}</code> should be a JSON boolean, <code>true</code> or <code>false</code>.</strong>
{% elif errors.0.validator == "type" and errors.0.validator_value == "object" %}
<strong><code>{{ errors.0.path_ending }}</code> should be a JSON object.</strong>
<strong><code>{{ errors.0.path_ending }}</code> is not an object. Object values must be enclosed in curly braces (<code>{</code> and <code>}</code>) and must contain only key/value pairs.</strong>
{% elif errors.0.validator == "minProperties" %}
<strong><code>{{ errors.0.path_ending }}</code> is an empty object. Fields with no value must be omitted in their entirety (key and value).</strong>
{% elif errors.0.validator == "dependencies" %}
<strong>{{ errors.0.message }}</strong>
{% elif errors.0.validator == "oneOf" and "schema" in errors.0.message and len(errors.0.path) > 2 and errors.0.path[-2] == "Period" and errors.0.path[-1] in ("start", "end") %}
<strong><code>{{ errors.0.path_ending }}</code> is incorrectly formatted. It must be formatted as a date (<code>YYYY-MM-DD</code>), a year-month (<code>YYYY-MM</code>) or a year (<code>YYYY</code>).</strong>
{% elif errors.0.validator == "anyOf" %}
<strong>{{ errors.0.message }}</strong>
{% else %}
Expand Down

0 comments on commit baf0ed4

Please sign in to comment.