11import type { Field } from './field/type'
2+ import type { CreateHeadlessFormOptions } from './form'
23import type { JsfObjectSchema , JsfSchema , JsonLogicContext , NonBooleanJsfSchema , ObjectValue , SchemaValue } from './types'
34import type { LegacyOptions } from './validation/schema'
45import { buildFieldSchema } from './field/schema'
@@ -24,18 +25,19 @@ export function calculateFinalSchema({
2425} : {
2526 schema : JsfObjectSchema
2627 values : SchemaValue
27- options ?: LegacyOptions
28+ options ?: CreateHeadlessFormOptions
2829} ) : JsfObjectSchema {
2930 const jsonLogicContext = schema [ 'x-jsf-logic' ] ? getJsonLogicContextFromSchema ( schema [ 'x-jsf-logic' ] , values ) : undefined
3031 const schemaCopy = safeDeepClone ( schema )
32+ const { legacyOptions, customJsonLogicOps } = options
3133
32- applySchemaRules ( schemaCopy , values , options , jsonLogicContext )
34+ applySchemaRules ( schemaCopy , values , legacyOptions , jsonLogicContext )
3335
3436 if ( jsonLogicContext ?. schema . computedValues ) {
35- applyComputedAttrsToSchema ( schemaCopy , jsonLogicContext . schema . computedValues , values )
37+ applyComputedAttrsToSchema ( schemaCopy , jsonLogicContext . schema . computedValues , values , customJsonLogicOps )
3638 // If we had computed values applied to the schema,
3739 // we need to re-apply the schema rules to update the fields
38- applySchemaRules ( schemaCopy , values , options , jsonLogicContext )
40+ applySchemaRules ( schemaCopy , values , legacyOptions , jsonLogicContext )
3941 }
4042
4143 return schemaCopy
0 commit comments