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

Use coerce and object/string #44

Open
kostyak76 opened this issue Dec 30, 2013 · 0 comments
Open

Use coerce and object/string #44

kostyak76 opened this issue Dec 30, 2013 · 0 comments

Comments

@kostyak76
Copy link

Hi!
Can you tell me if this is wrong behavior or not?
When I use _validate(obj,schema,{coerce:someFunction}) then I get an (TypeError: Cannot use 'in' operator to search for 'someField' in 1212 at checkObj (.../node_modules/json-schema/lib/validate.js:208:32)).
The schema has:

{
        "type": "object",
        "properties": {
            "code": {
                "type": "string",
                "pattern": "^\\w{6}$"
            }
        }
    }

But in obj instead of 'object' I receive 'string'.
I expect in this situation correct work of validation, but got a broken node.

It seems to me that at line 196 of validate.js we should use else statement as previous route if pass true test. And it is essentially to avoid any checks after errors are taken.

Can you please check my info and take appropriate actions?

Thank you in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant