formbuilder
formbuilder copied to clipboard
Return null values when no answers for nullable fields
With JSONSchema it is possible to set a empty value as Nullable.
{
"type":"object",
"properties":{
"user":{
"type":"object",
"properties":{
"profileType":{
"type":["string", "null"],
"enum":[
"INTERNAL_SHORT_PROFILE",
"EXTERNAL_SHORT_PROFILE",
"DEMO_SHORT_PROFILE"
]
},
"userId":{
"type":["string", "null"]
},
"email":{
"type":["string", "null"]
},
"photoId":{
"type":["string", "null"]
},
"statusPhrase":{
"type":["string", "null"]
},
"country":{
"type":["string", "null"]
},
"city":{
"type":["string", "null"]
},
"company":{
"type":["string", "null"]
},
"jobTitle":{
"type":["string", "null"]
},
"presenceStatus":{
"type":["string", "null"],
"enum":[
"OFFLINE",
"AVAILABLE",
"BUSY",
"AWAY",
"HIDDEN"
]
},
"emails":{
"type":"array",
"items":{
"type":"object",
"properties":{
"email":{
"type":["string", "null"]
},
"validated":{
"type":"boolean",
"required":true
},
"default":{
"type":"boolean",
"required":true
}
}
}
},
"phones":{
"type":"array",
"items":{
"type":"object",
"properties":{
"rawPhoneNumber":{
"type":["string", "null"]
},
"e164PhoneNumber":{
"type":["string", "null"]
},
"validated":{
"type":"boolean",
"required":true
},
"validable":{
"type":"boolean",
"required":true
},
"default":{
"type":"boolean",
"required":true
}
}
}
},
"tags":{
"type":["array", "null"],
"items":{
"type":["string", "null"]
}
},
"editable":{
"type":"boolean",
"required":true
},
"firstName":{
"type":["string", "null"]
},
"lastName":{
"type":["string", "null"]
},
"nickName":{
"type":["string", "null"]
}
}
}
}
}
When types contains null, we could add a checkbox to let people set the field value to null. If the ckeckbox is checked, the field should not be editable.
I don't understand what the value proposition is here. Can you try to describe an use case?