Thanks Stefan!
Another question in the same vein. We utilize lots of definitions in our schemas and then render them as properties in the schema. For example:
{
"title": "Commercial Auto Insurance",
"type": "object",
"definitions": {
"AgencyDetails": {
"title": "Agency Details",
"type": "object",
"definitions": {},
"required": [
"agencyName",
"agencyPhone",
"agencyFax",
"agencyCode",
"agencySubCode",
"agencyCustomerId"
],
"properties": {
"agencyName": {
"title": "Agency",
"type": "string",
"maxLength": 20000
},
"agencyPhone": {
"title": "Agency Phone ext",
"type": "string",
"maxLength": 20000
},
"agencyFax": {
"title": "Agency Fax",
"type": "string",
"maxLength": 20000
},
"agencyCode": {
"title": "Agency Code",
"type": "string",
"maxLength": 20000
},
"agencySubCode": {
"title": "Producer Code",
"type": "string",
"maxLength": 20000
},
"agencyCustomerId": {
"title": "Agency Customer ID",
"type": "string",
"maxLength": 20000
}
}
}
},
"required": [],
"properties": {
"agencyDetails": {
"title": "Agency Details",
"$ref": "#/definitions/AgencyDetails"
}
}
}
When generating a UISchema, using the generateDefaultUISchema function, all it spits out is:
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"scope": "#/properties/agencyDetails"
}
]
}
If I wanted to apply those options (hiding / showing based on siblings data) via a UISchema, what would that UISchema look like?
I’ve tried a few iterations (passing the definition to the generateDefaultUISchema function and appending to the UISchema, for example:
{
"type": "VerticalLayout",
"elements": [
{
"type": "Control",
"label": "Agency Details",
"scope": "#/properties/agencyDetails",
"elements": [
{
"type": "Control",
"scope": "#/properties/agencyName",
"options": {
"readonly": true
}
},
{
"type": "Control",
"scope": "#/properties/agencyPhone"
},
{
"type": "Control",
"scope": "#/properties/agencyFax"
},
{
"type": "Control",
"scope": "#/properties/agencyCode"
},
{
"type": "Control",
"scope": "#/properties/agencySubCode"
},
{
"type": "Control",
"scope": "#/properties/agencyCustomerId"
}
]
}
]
}
This appears to work, but adding things like an options object to my fields but nothing takes affect. I have a hunch the type “Control” ignores the elements array of the UISchema.
Is there any way to have UISchema control over these fields if they’re defined in this manner? Or do I need to restructure my schema?
Thanks for your help! This library is amazing and we’ve been using it in production for over a year now.