JSON Minimum Maximum Items validation

Clovertech Forums Cloverleaf JSON Minimum Maximum Items validation

  • Creator
    Topic
  • #117347
    David Burgess
    Participant

      I’ve been working with the JSON configurator and I’m trying to enforce minimum and maximum items for arrays.  I’ve turned on the root level validation, and successfully tested the “Required” option, but minimum and maximum don’t seem to have any effect that I can tell.  I’m using Cloverleaf 19.1 in an RHEL environment.  Should a violation of the min/max items in the configurator flag a validation error, or I’m I misunderstanding what a violation of the min/max items for arrays does?

      Thanks

    Viewing 3 reply threads
    • Author
      Replies
      • #117348
        Jim Kosloskey
        Participant

          I have not done JSON but maybe it is just like HL/7 variant lengths in that it simply truncates if the max is reached with no error.

          Perhaps for the Minimum it places a single space or null value when the minimum is not present.

          An interesting question.

          email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

        • #117349
          David Burgess
          Participant

            Thanks Jim!  I should test that for field definitions.  In this case I’m working with number of items in an array.  (For example I want to enforce that the Insurance array has a  minimum of one instance, but not more than three instances.)  I can of course manipulate that myself, but if the function exists in the tool, I’d love to use it to reject messages that fail validation as they come in the door.

          • #117350
            Jim Kosloskey
            Participant

              Well the X12 variant had max repetitions for some repeating items but I don’t recall if it actually did anything.

              It will be interesting to find out – keep us updated.

              email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

            • #118194
              David Burgess
              Participant

                Quick update on this issue.  The GUI allows you to only enter integer values for “min” and “max”, but under the hood the program expects something like “2.0” instead of “2”.  If you manually edit the JSON schema and insert the “.0”, it works fine.  Beware that if you later open the schema in the GUI the tool will remove the “.0” and any save will revert to back to non-working integers.  Infor has registered this as a problem and will work to work a fix into a future release/patch.

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.