Open ypnos opened 4 years ago
please provide a mini example, we need it to confirm this issue
Example LUA code:
local schema = {
type = 'object',
propertyNames = {
minLength = 4
},
}
local model = {
Foo = true
}
local options = {match_pattern=function () return true end, name="Test"}
local validator = JsonSchema.generate_validator(schema, options)
local isValid, errorStr = validator(model)
print(isValid, errorStr)
Expected output: false property name too short Observed output: true nil
When using online validators, I receive the expected output with the following input.
JSON schema:
{
"type": "object",
"propertyNames": { "minLength": 4 }
}
JSON model:
{
"Foo": true
}
@ypnos that is a todo feature, take a look at:
https://github.com/api7/jsonschema/blob/f8d2f40f9a3489a0c9430b81a40483982fdaa5f0/t/draft6.lua#L32 https://github.com/api7/jsonschema/blob/09dc6ed0524791c26772746a14cb4f83caeefc36/t/draft7.lua#L32
welcome PR to fix it
Currently it always returns true.
I cannot help out with this right now, this issue is to document the shortcoming so other users are aware.