Thanks a lot for the librar, I could digg a bit in the code, really nice :)
Just a quick question. I'm trying to read the schema from a URL. my current code looks like:
data class Mydata(val whatever: String)
fun loadSchemaFromFileSystem(): SchemaValidator {
val source = UrlSchemaSource(
url = URL("http://localhost:8081/schemas/ids/4"),
version = JsonSchemaVersion.DRAFT07,
baseUri = URI.create("http://localhost:8081/schemas/ids/4")
)
val schema = api.loadSchema(source)
return schema
}
fun checkThatIsInvalid(){
val validator = loadSchemaFromFileSystem()
val s = StringWriter()
val unvalidatedGenerator = objectMapper.factory.createGenerator(s)
val validatedGenerator = api.decorateJsonGenerator(validator, unvalidatedGenerator)
objectMapper.writeValue(validatedGenerator, Mydata("gfdgdfsg")) // this data is invalid
println(s)
}
I can see debugging a bit that the library is really reading my schema from the URL, however is always passing, not failing, doesnt matter if the data is valid or invalid. This change when I have the schema in my local file system (resources folder).
The schema I'm using to validate against looks like:
{
"$id": "http://example.com/myURI.schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Sample schema to help you get started.",
"properties": {
"myField1": {
"description": "The integer type is used for integral numbers.",
"type": "integer"
}
},
"required": [
"myField1"
],
"title": "value_with_default_schema",
"type": "object"
}
Am I doing something wrong?, I'm re-using the code I found in your tests.
Thanks a lot
Thanks a lot for the librar, I could digg a bit in the code, really nice :)
Just a quick question. I'm trying to read the schema from a URL. my current code looks like:
I can see debugging a bit that the library is really reading my schema from the URL, however is always passing, not failing, doesnt matter if the data is valid or invalid. This change when I have the schema in my local file system (resources folder).
The schema I'm using to validate against looks like:
Am I doing something wrong?, I'm re-using the code I found in your tests. Thanks a lot