I have the following rjsf(react-jsonschema-form) schema:
{
"properties": {
"default": {
"title": "default",
"type": "object",
"ui:group": true,
"properties": {
"localLimitersOnTop": {
"type": "object",
"title": "Display local collection limiters above database limiters on search screen",
"properties": {
"enabled": {
"type": "boolean",
"title": "Select Yes to place the local limiters above the "common" limiters on the search screen.",
"description": "",
"ui:storedproc": "PROFILELIMITERSLIST",
"default": false,
"oneOf": [
{
"const": true,
"title": "Yes"
},
{
"const": false,
"title": "No"
}
]
}
},
"required": [
"enabled"
]
},
"includeLinkedFullText": {
"type": "object",
"title": "Include linked full-text journals when using the full-text limiter",
"properties": {
"enabled": {
"type": "boolean",
"title": "Indicate whether the full text limiter will limit to results available through SmartLinking as well as full text available with the database. (On Student Research Center, this is applied to a Teacher Resources Search only.)",
"description": "",
"ui:storedproc": "PROFILELINKEDTEXT",
"default": true,
"oneOf": [
{
"const": true,
"title": "On"
},
{
"const": false,
"title": "Off"
}
]
}
},
"required": [
"enabled"
]
},
"includeCatalogsAndIRsInFullTextLimiter": {
"type": "object",
"title": "Include catalogs and IRs in full-text limiter",
"properties": {
"enabled": {
"type": "boolean",
"title": "",
"description": "",
"default": false,
"oneOf": [
{
"const": true,
"title": "Yes"
},
{
"const": false,
"title": "No"
}
]
}
},
"required": [
"enabled"
]
},
"dbLimiters": {
"title": "Database Limiters",
"ui:model-edit-title": "Database Limiters",
"properties": {
"screen": {
"type": "string",
"ui:type": "DropDownList",
"ui:storedproc": "DBLIMITERSINTERFACESCREENLIST",
"default":"basic",
"oneOf": [
{
"type": "string",
"title": "Basic",
"enum": [
"basic"
]
}
],
"description": "Screen"
},
"languageCodes": {
"type": "string",
"ui:type": "DropDownList",
"ui:storedproc": "INTERFACELANGUAGELIST",
"default":"en",
"oneOf": [
{
"type": "string",
"title": "English",
"enum": [
"en"
]
},
{
"type": "string",
"title": "Hindi",
"enum": [
"hi"
]
}
],
"description": "Select language for the label field"
},
"dbLimiters": {
"ui:hide-reorder-buttons": false,
"ui:static-table": true,
"ui:order-prop": "orderNo",
"type": "array",
"title": "",
"required": [
"orderNo",
"limiterTag",
"label"
],
"items": {
"type": "object",
"properties": {
"limiterTag": {
"type": "string",
"title": "Limiter Tag",
"ui:static": true
},
"default": {
"title": "Default",
"anyOf": [
{
"type": "boolean"
},
{
"type": "string"
},
{
"type": "integer"
}
],
"ui:dynamic": true
},
"orderNo": {
"type": "integer",
"title": "Order",
"ui:hide-in-table": true
},
"show": {
"type": "boolean",
"title": "Show"
},
"label": {
"type": "string",
"title": "Edit Limiter Label for",
"ui:static": false
}
}
}
}
}
}
}
}
}
}
I have the following initialData:
{
"default": {
"localLimitersOnTop": {
"enabled": true
},
"includeLinkedFullText": {},
"includeCatalogsAndIRsInFullTextLimiter": {
"enabled": false
},
"dbLimiters": {
"languageCodes": "en",
"dbLimiters": [
{
"limiterTag": "FT",
"label": "Linked full text",
"default": true,
"orderNo": 1,
"show": true
}
]
}
}
}
I require a new object based on the rjsf schema and initialData.
The requirement is to consider only the fields which have "ui:storedproc" defined inside them and if that field doesnt have initial data defined for it in initialData then consider its initial data to be its default value.
The expected object should look like:
{
"default": {
"localLimitersOnTop": {
"enabled": true
},
"includeLinkedFullText": {
"enabled": true
},
"dbLimiters": {
"screen": "basic",
"languageCodes": "en"
}
}
}
give a function that can take in rjsf schema and initialData and can return the expected object