@@ -31,7 +31,7 @@ export type TemplateOptions = {
3131 */
3232 recursionLimit ?: number ;
3333 /** @internal disables recursion limit for next call */
34- disableRecusionLimit ?: boolean ;
34+ disableRecursionLimit ?: boolean ;
3535 /** @internal context to track recursion limit */
3636 cache ?: Record < string , Record < string , number > > ;
3737} ;
@@ -46,10 +46,10 @@ function safeResolveRef(node: SchemaNode, options: TemplateOptions) {
4646 cache [ origin ] = cache [ origin ] ?? { } ;
4747 cache [ origin ] [ node . $ref ] = cache [ origin ] [ node . $ref ] ?? 0 ;
4848 const value = cache [ origin ] [ node . $ref ] ;
49- if ( value >= recursionLimit && options . disableRecusionLimit !== true ) {
49+ if ( value >= recursionLimit && options . disableRecursionLimit !== true ) {
5050 return false ;
5151 }
52- options . disableRecusionLimit = false ;
52+ options . disableRecursionLimit = false ;
5353 cache [ origin ] [ node . $ref ] += 1 ;
5454 const resolvedNode = node . resolveRef ( ) ;
5555 if ( 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 > = {
171171 null : ( 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) => {
177177 object : ( node , data , opts ) => {
178178 const schema = node . schema ;
@@ -188,8 +188,8 @@ const TYPE: Record<string, (node: SchemaNode, data: unknown, opts: TemplateOptio
188188 const 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
190190 if ( 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 ) {
193193 d [ propertyName ] = propertyValue ;
194194 }
195195 }
@@ -277,7 +277,7 @@ const TYPE: Record<string, (node: SchemaNode, data: unknown, opts: TemplateOptio
277277 const itemCount = Math . max ( minItems , d . length ) ;
278278 for ( let i = 0 ; i < itemCount ; i += 1 ) {
279279 opts . cache = copy ( cache ) ;
280- const options = { ...opts , disableRecusionLimit : true } ;
280+ const options = { ...opts , disableRecursionLimit : true } ;
281281 d [ 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
316316 const cache = { ...opts . cache } ;
317317 for ( let i = 0 , l = Math . max ( minItems , d . length ) ; i < l ; i += 1 ) {
318318 opts . cache = copy ( cache ) ;
319- const options = { ...opts , disableRecusionLimit : true } ;
319+ const options = { ...opts , disableRecursionLimit : true } ;
320320 const result = node . items . getData ( d [ i ] == null ? template [ i ] : d [ i ] , options ) ;
321321 // @attention if getData aborts recursion it currently returns undefined)
322322 if ( result === undefined ) {
@@ -342,4 +342,4 @@ function getDefault({ schema }: SchemaNode, templateValue: any, initValue: any,
342342 return initValue ;
343343 }
344344 return schema . default ;
345- }
345+ }
0 commit comments