DigitalDataChainConsortium / vdi2770

Implementation of VDI 2770 specifications
https://github.com/DigitalDataChainConsortium/vdi2770
MIT License
3 stars 1 forks source link

Validate labels of class names case-insensitive #15

Open janoevermann opened 2 years ago

janoevermann commented 2 years ago

What is the current behavior?

The validator compares the class name case-sensitive against a list of predefined values.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

VDI 2770 document container with lower-case english class name

What is the expected behavior?

The validator compares case-insensitive

What is the motivation / use case for changing the behavior?

7 made it necessary for VDI 2770 producers to transform the correct English class names to lower-case to pass validation.

The changes introduced in bda5dcf12d174f3aab186c355415e991691113e2 make the packages generated in this manner now invalid.

Example

Current behavior:

  <DocumentClassification ClassificationSystem="VDI2770:2018">
    <ClassId>01-01</ClassId>
    <ClassName Language="de">Identifikation</ClassName>
    <ClassName Language="en">Identification</ClassName>
  </DocumentClassification>

✔️ valid

  <DocumentClassification ClassificationSystem="VDI2770:2018">
    <ClassId>01-01</ClassId>
    <ClassName Language="de">Identifikation</ClassName>
    <ClassName Language="en">identification</ClassName>
  </DocumentClassification>

⛔ invalid

Expected behavior:

  <DocumentClassification ClassificationSystem="VDI2770:2018">
    <ClassId>01-01</ClassId>
    <ClassName Language="de">Identifikation</ClassName>
    <ClassName Language="en">Identification</ClassName>
  </DocumentClassification>

✔️ valid

  <DocumentClassification ClassificationSystem="VDI2770:2018">
    <ClassId>01-01</ClassId>
    <ClassName Language="de">Identifikation</ClassName>
    <ClassName Language="en">identification</ClassName>
  </DocumentClassification>

✔️ valid

Please tell us about your environment:

plusmeta Platform

schmidt-uni-leipzig commented 2 years ago

Imo, this is not a bug. VDI 2770 exactly declares class names. The guideline does not specify, that class names are case insensitive.

The validation REST API supports a parameter named enableStrictMode (see vdi2770-validator/vdi2770-validator/src/docs/asciidoc/overview.adoc. This parameter is given to the processor component. vdi2770-processor/src/docs/asciidoc/overview.adoc describes in section "Strict Validation" the strict validation contains includinig the document class names.

To support lower case class validation, please set enableStrictMode to false. The disabled strict mode is documented in the report.

Here is an example:

curl -X POST -H 'api-key: foo' -F 'file=@demo_vdi.zip' -F 'settings={"enableStrictMode":false}' http://example.com/rest/reportpdf --output report.pdf
janoevermann commented 2 years ago

Just to be clear, our software originally followed the specification closely (case sensitive class names) but #7 made it necessary for us to transform the correct English class names to lower-case class names to pass validation.

The changes introduced in https://github.com/DigitalDataChainConsortium/vdi2770/commit/bda5dcf12d174f3aab186c355415e991691113e2 make the packages generated in this manner now invalid, because these packages contain a fix which was only introduced for the validator.

Most of our customers use the validator hosted on the DDCC website which is (as far as I know) set to strict mode. Setting this instance to strict=false could also solve the problem.