Virtualization Plugins

Expand all | Collapse all

Optional integer is giving error when user leaves it blank.

  • 1.  Optional integer is giving error when user leaves it blank.

    Posted 01-10-2020 12:24:00 PM

    I received an error when I did not enter a value for an optional integer entry.
    Is there a way in the schema.json to provide a default so this does not happen?
    Even if a default is not provided and a value is not provided it should not error if it is not required.

    Error when a value is not entered for an integer value that is optional.


    ------------------------------
    Paul Jauquet
    Senior Data Services Consultant
    Axis Technology, LLC
    ------------------------------


  • 2.  RE: Optional integer is giving error when user leaves it blank.

    Posted 01-13-2020 12:46:00 PM
    Paul, could you post the schema you are using? Do you also have the POST request that was sent by the UI, maybe using "Developer Tools" in Chrome?

    ------------------------------
    Ankur Sarin
    Senior Engineering Manager
    Delphix
    ------------------------------



  • 3.  RE: Optional integer is giving error when user leaves it blank.

    Posted 01-13-2020 05:42:00 PM
    I tested this out and am not seeing the same behavior. Here is the linked source schema I tested with:


    "linkedSourceDefinition": {
      "type": "object",
      "additionalProperties" : false,
      "properties" : {
        "optionalInteger": {
        "type": "integer"
        }
      }
    }


    I was able to link a new dSource from the UI without specifying a value for this integer. Here is the JSON object from the payload that the UI sent to the engine:

    {}

    (In other words, the UI app is not making any mention whatsoever of the optionalInteger property, which is correct).


    The error message Paul is getting seems to imply that someone is specifying null as the value of the integer. That is, with my schema, the payload would have to look something like this in order to get the same error as Paul.

    {
      "optionalInteger": null
    }

    (With JSON objects, setting a property to null is not the same thing as not specifying the property at all)


    I guess we'd next want to figure out where this null is coming from. Is it from our UI?


    As an aside: Using "default" would not solve this issue. The only thing it is used for is to auto-fill the UI widget. For example, it does not mean "If the user does not provide a value, then use this default value instead".

    ------------------------------
    Tom Walsh
    Software Engineer
    Delphix
    ------------------------------