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
------------------------------
Original Message:
Sent: 01-13-2020 01:46:09 PM
From: Ankur Sarin
Subject: Optional integer is giving error when user leaves it blank.
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
Original Message:
Sent: 01-10-2020 01:24:11 PM
From: Paul Jauquet
Subject: Optional integer is giving error when user leaves it blank.
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.
------------------------------
Paul Jauquet
Senior Data Services Consultant
Axis Technology, LLC
------------------------------