Skip to content

Validation error for "id" field in referenced schema  #1093

Open
@gourav157537

Description

@gourav157537

Library is giving error java.lang.UnsupportedOperationException: No suitable validator for id
PFA java class to reproduce issue version 1.4.0 and 1.5.0. Issue is not produced in old version of library version 1.0.86
New folder.zip
Run attached java class issue will be reproduced, replace line 81 with main1.json, and notice data validated without id field in ref schema
StackTrace
Exception in thread "main" com.networknt.schema.JsonSchemaException: java.lang.UnsupportedOperationException: No suitable validator for id
at com.networknt.schema.JsonMetaSchema.newValidator(JsonMetaSchema.java:508)
at com.networknt.schema.ValidationContext.newValidator(ValidationContext.java:63)
at com.networknt.schema.JsonSchema.read(JsonSchema.java:545)
at com.networknt.schema.JsonSchema.getValidators(JsonSchema.java:1325)
at com.networknt.schema.JsonSchema.(JsonSchema.java:151)
at com.networknt.schema.JsonSchema.from(JsonSchema.java:66)
at com.networknt.schema.JsonSchemaFactory.doCreate(JsonSchemaFactory.java:369)
at com.networknt.schema.JsonSchemaFactory.create(JsonSchemaFactory.java:365)
at com.networknt.schema.ValidationContext.newSchema(ValidationContext.java:58)
at com.networknt.schema.NonValidationKeyword$Validator.(NonValidationKeyword.java:46)
at com.networknt.schema.NonValidationKeyword.newValidator(NonValidationKeyword.java:66)
at com.networknt.schema.JsonMetaSchema.newValidator(JsonMetaSchema.java:496)
at com.networknt.schema.ValidationContext.newValidator(ValidationContext.java:63)
at com.networknt.schema.JsonSchema.read(JsonSchema.java:545)
at com.networknt.schema.JsonSchema.getValidators(JsonSchema.java:1325)
at com.networknt.schema.JsonSchema.(JsonSchema.java:151)
at com.networknt.schema.JsonSchema.from(JsonSchema.java:66)
at com.networknt.schema.JsonSchemaFactory.doCreate(JsonSchemaFactory.java:369)
at com.networknt.schema.JsonSchemaFactory.newJsonSchema(JsonSchemaFactory.java:334)
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:526)
at com.networknt.schema.JsonSchemaFactory.getSchema(JsonSchemaFactory.java:509)
at NetworkNtIssue.main(NetworkNtIssue.java:80)
Caused by: java.lang.UnsupportedOperationException: No suitable validator for id
at com.networknt.schema.ValidatorTypeCode.newValidator(ValidatorTypeCode.java:161)
at com.networknt.schema.JsonMetaSchema.newValidator(JsonMetaSchema.java:496)
... 21 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions