Skip to content

Validator hang on validation #44

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

Closed
sginer opened this issue Oct 19, 2017 · 13 comments
Closed

Validator hang on validation #44

sginer opened this issue Oct 19, 2017 · 13 comments

Comments

@sginer
Copy link

sginer commented Oct 19, 2017

Validator never comme back and give result.

I put schema and json file I used.

Regards

localfile.zip

@stevehu
Copy link
Contributor

stevehu commented Oct 20, 2017

@sginer Thanks for your schema and test json. I see you have a very big schema with over 30K lines and I remember there is another user had the same issue before with a very big schema. I think the problem is we are loading and compiling the entire schema into memory in order to speed up the validation and if the schema is too big, it might not be performing. I will create a test case and try to get it fixed; however, it will take some time as I have other projects that need urgent attentions. Let's keep this issue open until we have the result.

@stevehu
Copy link
Contributor

stevehu commented Oct 20, 2017

This is the same issue like #28 but with test schema and test data to reproduce the issue.

@cncqycy
Copy link

cncqycy commented Oct 24, 2017

@stevehu
i have the same problem. I think it's the "$ref" cause some infinite loop.
Here is my json schema:
{
"type":"array"
,"items":{"$ref":"#/definitions/compositeFilterSchema"}
,"additionalItems": false
,"minItems": 1
,"maxItems": 10
,"uniqueItems": true
,"definitions":
{
"compositeFilterSchema":{
"anyOf":[
{"$ref":"#/definitions/simpleFilterSchema"}
,{"$ref":"#/definitions/logicalAndSchema"}
,{"$ref":"#/definitions/logicalOrSchema"}
]
}
,"simpleFilterSchema":
{
"properties":
{
"col":{
"type":"string"
}
,"op":{
"type":"string"
,"enum":["eq","neq","match",""]
}
,"val":{
"oneOf":[
{"type":"string"}
,{"type":"number"}
,{
"type":"array"
,"minItems":1
,"maxItems":100
,"uniqueItems": true
,"items":{
"anyOf":[
{"type":"string"}
,{"type":"number"}
]
}
}
]
}
}
,"additionalProperties":false
,"required":["column","op"]
}
,"logicalAndSchema":
{
"properties":
{
"and":{"$ref":"#/definitions/compositeFilterSchema"}
}
}
,"logicalOrSchema":
{
"properties":
{
"or":{"$ref":"#/definitions/compositeFilterSchema"}
}
}
}
}

@stevehu stevehu added the bug label Oct 24, 2017
@stevehu
Copy link
Contributor

stevehu commented Oct 24, 2017

@cncqycy Thanks for you schema. It helps us to narrow the focus.

@aritrac
Copy link

aritrac commented Sep 17, 2018

Hi @stevehu is this issue fixed in the latest release? I am having kind of same issue where there are additioanl $refs within a definition pointing to the parent definition. So some kindof cyclic dependency issue is there. Please let me know if you need any further details.

Thanks

@stevehu
Copy link
Contributor

stevehu commented Sep 17, 2018

I think this is fixed already. I have a test case for the circular Sep but it would be good if you could submit your test case to ensure that it works for your schema. Thanks.

@aritrac
Copy link

aritrac commented Sep 18, 2018

Hi @stevehu , thank you for your reply. I am providing the schema which is making the parser hang. It would be great if you can have a look. Thanks a lot for your time and help again

{
"$schema" : "http://json-schema.org/draft-04/schema#",
"title" : "Recursion-with-two-arrays",
"type" : "object",
"additionalProperties" : false,
"properties" : {
"first" : {
"$ref" : "#/definitions/A"
}
},
"definitions" : {
"A" : {
"type" : "object",
"additionalProperties" : false,
"properties" : {
"one" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/A"
}
},
"two" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/A"
}
}
}
}
}
}

@aritrac
Copy link

aritrac commented Sep 18, 2018

Also if it might help you, we are currently using 0.1.6 version @stevehu

@stevehu
Copy link
Contributor

stevehu commented Sep 18, 2018

@aritrac Sorry. I fixed the json-overlay and openapi-parser for the circular dependencies. I need to find time to rewrite the json-schema-validator. Thanks.

@aritrac
Copy link

aritrac commented Sep 18, 2018

@stevehu No issues, please let me know any tentative time when you are planning for the next release for the json-schema-validator. Thanks for your efforts for the same.

@aritrac
Copy link

aritrac commented Oct 12, 2018

@stevehu would you please let us know if this bug is fixed?

@stevehu
Copy link
Contributor

stevehu commented Oct 12, 2018

@aritrac This is still not fixed yet. I was planning to rewrite this library with json-overlay but need to get at least several days to do so. It is hard to squeeze at the moment and I have marked this as help wanted. Hopefully, someone from the community can take an action. Thanks.

@stevehu
Copy link
Contributor

stevehu commented Aug 7, 2019

This should be addressed by @davidvisiedo in #180

@stevehu stevehu closed this as completed Aug 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants