@@ -100,17 +100,22 @@ function removeInvalidAttributes(fields) {
100100 *
101101 * @returns {FieldParameters }
102102 */
103- function buildFieldParameters ( name , fieldProperties , required = [ ] , config = { } ) {
103+ function buildFieldParameters ( name , fieldProperties , required = [ ] , config = { } , validations ) {
104104 const { position } = pickXKey ( fieldProperties , 'presentation' ) ?? { } ;
105105 let fields ;
106106
107107 const inputType = getInputType ( fieldProperties , config . strictInputType , name ) ;
108108
109109 if ( inputType === supportedTypes . FIELDSET ) {
110110 // eslint-disable-next-line no-use-before-define
111- fields = getFieldsFromJSONSchema ( fieldProperties , {
112- customProperties : get ( config , `customProperties.${ name } ` , { } ) ,
113- } ) ;
111+ fields = getFieldsFromJSONSchema (
112+ fieldProperties ,
113+ {
114+ customProperties : get ( config , `customProperties.${ name } ` , { } ) ,
115+ parentID : name ,
116+ } ,
117+ validations
118+ ) ;
114119 }
115120
116121 const result = {
@@ -137,15 +142,16 @@ function buildFieldParameters(name, fieldProperties, required = [], config = {})
137142 */
138143function convertJSONSchemaPropertiesToFieldParameters (
139144 { properties, required, 'x-jsf-order' : order } ,
140- config = { }
145+ config = { } ,
146+ validations
141147) {
142148 const sortFields = ( a , b ) => sortByOrderOrPosition ( a , b , order ) ;
143149
144150 // Gather fields represented at the root of the node , sort them by
145151 // their position and then remove the position property (since it's no longer needed)
146152 return Object . entries ( properties )
147153 . filter ( ( [ , value ] ) => typeof value === 'object' )
148- . map ( ( [ key , value ] ) => buildFieldParameters ( key , value , required , config ) )
154+ . map ( ( [ key , value ] ) => buildFieldParameters ( key , value , required , config , validations ) )
149155 . sort ( sortFields )
150156 . map ( ( { position, ...fieldParams } ) => fieldParams ) ;
151157}
@@ -233,7 +239,8 @@ function buildField(fieldParams, config, scopedJsonSchema, validations) {
233239
234240 const yupSchema = buildYupSchema ( fieldParams , config , validations ) ;
235241 const calculateConditionalFieldsClosure =
236- fieldParams . isDynamic && calculateConditionalProperties ( fieldParams , customProperties ) ;
242+ fieldParams . isDynamic &&
243+ calculateConditionalProperties ( fieldParams , customProperties , validations , config ) ;
237244
238245 const calculateCustomValidationPropertiesClosure = calculateCustomValidationProperties (
239246 fieldParams ,
@@ -283,7 +290,11 @@ function getFieldsFromJSONSchema(scopedJsonSchema, config, validations) {
283290 return [ ] ;
284291 }
285292
286- const fieldParamsList = convertJSONSchemaPropertiesToFieldParameters ( scopedJsonSchema , config ) ;
293+ const fieldParamsList = convertJSONSchemaPropertiesToFieldParameters (
294+ scopedJsonSchema ,
295+ config ,
296+ validations
297+ ) ;
287298
288299 applyFieldsDependencies ( fieldParamsList , scopedJsonSchema ) ;
289300
0 commit comments