Kernel Validation is stricter than SME validation and unexpectedly failes

Hello.

I inspect a not-so-obvious issue in my project.

In the SME, my computation is fine. Hitting “Validate” finds nothing.

Generating the Validation Code with Kernels Java-Library, especially com.mgmtp.a12.kernel.md.model.a12internal.services.codegen.cli.BatchVkValidationCodeGeneratorJs finds 4 errors regarding the error text:


0 = {MVKCoreError@3236} "com.mgmtp.a12.kernel.core.utils.internal.MVKCoreError: The error text has to be specified. [MVK_ERROR_MESSAGE_MISSING]"
1 = {MVKCoreError@3237} "com.mgmtp.a12.kernel.core.utils.internal.MVKCoreError: The error text has to be specified. [MVK_ERROR_MESSAGE_MISSING]"
2 = {MVKCoreError@3238} "com.mgmtp.a12.kernel.core.utils.internal.MVKCoreError: The rule '/root/content/xxxComputation' does not specify an error text for the language Deutsch. [RULE_HAS_NO_ERRORTEXT]"
3 = {MVKCoreError@3239} "com.mgmtp.a12.kernel.core.utils.internal.MVKCoreError: The rule '/root/content/xxxComputation' does not specify an error text for the language Deutsch. [RULE_HAS_NO_ERRORTEXT]"

That arises two questions:

  1. Why does the SME does not show that ?
  2. Where shall I enter that error messages ?

I can’t see an input field for it:

Please help.

Stefan.

Hi Stefan,
that’s weird. For computations, there isn’t a field in the SME to enter an error text. However, upon saving a placeholder error message will be added to the model’s json. It should look like this:

{
                "type": "Computation",
                "id": "computation_d036f",
                "name": "comp_NeuerKommentar",
                "Computation": {
                  "computedFieldRelPath": "../NeuerKommentar",
                  "computationAlternatives": [
                    {
                      "operation": "True",
                      "precondition": "NumberOfFilledGroups(Kommentare*) > NumberOfValueInFields(True IN Kommentare*/Erledigt)"
                    },
                    {
                      "operation": "False",
                      "precondition": "NumberOfFilledGroups(Kommentare*) <= NumberOfValueInFields(True IN Kommentare*/Erledigt)"
                    }
                  ],
                  "errorMessage": [
                    {
                      "locale": "de",
                      "text": "error text for computation of comp_NeuerKommentar"
                    }
                  ]
                }
              }

It seems like error message part wasn’t generated in your case. For a quick fix, you could probably add it manually to the json.

But maybe someone from the A12 team can chime in as to why this could’ve happened and how to prevent it.

Lea

Hi @stefan-cached-grove, as @lea-clear-clover already mentioned, that is weird. If you created the Document Model with the SME, the SME should have generated the JSON part that @lea-clear-clover showed. The “Validate” button and the Tool BatchVkValidationCodeGeneratorJs should report the same errors.

That is the point: I haven’t used the SME for model creation.

In my project we have a Java Project creating A12-Models. But, we validate the generated models against the SME. The “error message” part in the models is a like a “hidden feature”: You have to know about it, otherwise the result is wrong. I, as the developer of the Modelgenerator project, must have known about the “hidden feature” you have there. I haven’t implemented it on my side. I learned from @arvid-slim-lake about the nature of the custom error messages.

However, in my opinion the SME must validate exactly like the kernel does. The SME is the “most available tool” for everything.

Hi @stefan-cached-grove

The SME is indeed

It’s also the only tool that we use for model generation. We perform a wide range of tests to ensure that the models created in the SME are valid.

In this specific case, the model is correctly created by the SME. As the modeler cannot influence the error message

"errorMessage": [
                    {
                      "locale": "de",
                      "text": "error text for computation of comp_NeuerKommentar"
                    }
                  ]

showing an error message would simply lead to a strange UI where there is an unfixable error.