Skip to content

Cyclic dependencies result in StackOverflowError #258

@mihaiba

Description

@mihaiba

Having schemaA with property referencing schemaB and schemaB referencing schemaA results in StackOverflowError:

Caused by: com.networknt.schema.JsonSchemaException: java.lang.StackOverflowError
	at com.networknt.schema.JsonMetaSchema.newValidator(JsonMetaSchema.java:346)
	at com.networknt.schema.ValidationContext.newValidator(ValidationContext.java:50)
	at com.networknt.schema.JsonSchema.read(JsonSchema.java:159)
	at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:76)
	at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:62)
	at com.networknt.schema.PropertiesValidator.<init>(PropertiesValidator.java:35)
	at sun.reflect.GeneratedConstructorAccessor34.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.networknt.schema.ValidatorTypeCode.newValidator(ValidatorTypeCode.java:128)
	at com.networknt.schema.JsonMetaSchema.newValidator(JsonMetaSchema.java:340)
	at com.networknt.schema.ValidationContext.newValidator(ValidationContext.java:50)
	at com.networknt.schema.JsonSchema.read(JsonSchema.java:159)
	at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:76)
	at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:62)
	at com.networknt.schema.JsonSchema.<init>(JsonSchema.java:57)
	at com.networknt.schema.JsonSchemaFactory.newJsonSchema(JsonSchemaFactory.java:253)
	at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:330)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions