@@ -1597,23 +1597,31 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
15971597 return { error : `Resource '${ resourceId } ' not found` } ;
15981598 }
15991599 const validationResults = { } ;
1600+ const customColumnValidatorsFunctions = [ ] ;
16001601 for ( const col of editableColumns ) {
16011602 const columnConfig = resource . columns . find ( ( c ) => c . name === col . name ) ;
16021603 if ( columnConfig && columnConfig . validation ) {
1603- for ( const val of columnConfig . validation ) {
1604- if ( val . validator ) {
1605- const result = await val . validator ( col . value , record , this . adminforth ) ;
1606- if ( typeof result === 'object' && result . isValid === false ) {
1607- validationResults [ col . name ] = {
1608- isValid : result . isValid ,
1609- message : result . message ,
1604+ customColumnValidatorsFunctions . push ( async ( ) => {
1605+ for ( const val of columnConfig . validation ) {
1606+ if ( val . validator ) {
1607+ const result = await val . validator ( col . value , record , this . adminforth ) ;
1608+ if ( typeof result === 'object' && result . isValid === false ) {
1609+ validationResults [ col . name ] = {
1610+ isValid : result . isValid ,
1611+ message : result . message ,
1612+ }
1613+ break ;
16101614 }
1611- break ;
16121615 }
16131616 }
1614- }
1617+ } )
16151618 }
16161619 }
1620+
1621+ if ( customColumnValidatorsFunctions . length ) {
1622+ await Promise . all ( customColumnValidatorsFunctions . map ( ( fn ) => fn ( ) ) ) ;
1623+ }
1624+
16171625 return {
16181626 validationResults
16191627 }
0 commit comments