@@ -31,7 +31,7 @@ export type TemplateOptions = {
3131 */
3232recursionLimit ?:number ;
3333/**@internal disables recursion limit for next call */
34- disableRecusionLimit ?:boolean ;
34+ disableRecursionLimit ?:boolean ;
3535/**@internal context to track recursion limit */
3636cache ?:Record < string , Record < string , number > > ;
3737} ;
@@ -46,10 +46,10 @@ function safeResolveRef(node: SchemaNode, options: TemplateOptions) {
4646cache [ origin ] = cache [ origin ] ?? { } ;
4747cache [ origin ] [ node . $ref ] = cache [ origin ] [ node . $ref ] ?? 0 ;
4848const value = cache [ origin ] [ node . $ref ] ;
49- if ( value >= recursionLimit && options . disableRecusionLimit !== true ) {
49+ if ( value >= recursionLimit && options . disableRecursionLimit !== true ) {
5050return false ;
5151}
52- options . disableRecusionLimit = false ;
52+ options . disableRecursionLimit = false ;
5353cache [ origin ] [ node . $ref ] += 1 ;
5454const resolvedNode = node . resolveRef ( ) ;
5555if ( resolvedNode && resolvedNode !== node ) {
@@ -169,10 +169,10 @@ export function getData(node: SchemaNode, data?: unknown, opts?: TemplateOptions
169169
170170const TYPE :Record < string , ( node :SchemaNode , data :unknown , opts :TemplateOptions ) => unknown > = {
171171null :( node , data , opts ) => getDefault ( node , data , null , opts . useTypeDefaults ) ,
172- string :( node , data , opts ) => getDefault ( node , data , "" , opts . useTypeDefaults ) ,
173- number :( node , data , opts ) => getDefault ( node , data , 0 , opts . useTypeDefaults ) ,
174- integer :( node , data , opts ) => getDefault ( node , data , 0 , opts . useTypeDefaults ) ,
175- boolean :( node , data , opts ) => getDefault ( node , data , false , opts . useTypeDefaults ) ,
172+ string :( node , data , opts ) => getDefault ( node , data , "" , opts . useTypeDefaults ) ,
173+ number :( node , data , opts ) => getDefault ( node , data , 0 , opts . useTypeDefaults ) ,
174+ integer :( node , data , opts ) => getDefault ( node , data , 0 , opts . useTypeDefaults ) ,
175+ boolean :( node , data , opts ) => getDefault ( node , data , false , opts . useTypeDefaults ) ,
176176// object: (draft, schema, data: Record<string, unknown> | undefined, pointer: JsonPointer, opts: TemplateOptions) => {
177177object :( node , data , opts ) => {
178178const schema = node . schema ;
@@ -188,8 +188,8 @@ const TYPE: Record<string, (node: SchemaNode, data: unknown, opts: TemplateOptio
188188const value = data === undefined || input === undefined ?getValue ( template , propertyName ) :input ;
189189// Omit adding a property if it is not required or optional props should be added
190190if ( value != null || isRequired || opts . addOptionalProps ) {
191- const propertyValue = propertyNode . getData ( value , opts ) ;
192- if ( propertyValue !== undefined || opts . useTypeDefaults !== false ) {
191+ const propertyValue = propertyNode . getData ( value , opts ) ;
192+ if ( propertyValue !== undefined || opts . useTypeDefaults !== false ) {
193193d [ propertyName ] = propertyValue ;
194194}
195195}
@@ -277,7 +277,7 @@ const TYPE: Record<string, (node: SchemaNode, data: unknown, opts: TemplateOptio
277277const itemCount = Math . max ( minItems , d . length ) ;
278278for ( let i = 0 ; i < itemCount ; i += 1 ) {
279279opts . cache = copy ( cache ) ;
280- const options = { ...opts , disableRecusionLimit :true } ;
280+ const options = { ...opts , disableRecursionLimit :true } ;
281281d [ i ] = node . items . getData ( d [ i ] == null ?template [ i ] :d [ i ] , options ) ;
282282}
283283}
@@ -316,7 +316,7 @@ const TYPE: Record<string, (node: SchemaNode, data: unknown, opts: TemplateOptio
316316const cache = { ...opts . cache } ;
317317for ( let i = 0 , l = Math . max ( minItems , d . length ) ; i < l ; i += 1 ) {
318318opts . cache = copy ( cache ) ;
319- const options = { ...opts , disableRecusionLimit :true } ;
319+ const options = { ...opts , disableRecursionLimit :true } ;
320320const result = node . items . getData ( d [ i ] == null ?template [ i ] :d [ i ] , options ) ;
321321//@attention if getData aborts recursion it currently returns undefined)
322322if ( result === undefined ) {
@@ -342,4 +342,4 @@ function getDefault({ schema }: SchemaNode, templateValue: any, initValue: any,
342342return initValue ;
343343}
344344return schema . default ;
345- }
345+ }