Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propertyNames validation is missing #38

Open
ypnos opened this issue Oct 8, 2020 · 3 comments
Open

propertyNames validation is missing #38

ypnos opened this issue Oct 8, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@ypnos
Copy link
Contributor

ypnos commented Oct 8, 2020

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.

@membphis
Copy link
Contributor

membphis commented Oct 8, 2020

please provide a mini example, we need it to confirm this issue

@ypnos
Copy link
Contributor Author

ypnos commented Oct 8, 2020

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
}

@membphis
Copy link
Contributor

membphis commented Oct 9, 2020

@ypnos that is a todo feature, take a look at:

['propertyNames validation'] = { -- todo

['propertyNames validation'] = { -- todo

welcome PR to fix it

@membphis membphis added enhancement New feature or request help wanted Extra attention is needed labels Oct 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants