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

org.everit.json.schema.NotSchema.toString throws JSONException for valid json *not* schemas #345

Closed
alin-t opened this issue Nov 28, 2019 · 1 comment

Comments

@alin-t
Copy link

alin-t commented Nov 28, 2019

When parsing a valid JSON schema, toString method of the returned object throws the following exception: JSONException("Misplaced key.")

{  
   "$schema":"http://json-schema.org/draft-04/schema#",
   "not":{  
      "type":"object",
      "properties":{  
         "name":{  
            "type":"string"
         }
      }
   }
}

There are cases when the not schema is parsed correctly and toString method works as intended:

{  
   "not":{  
      "type":"object",
      "properties":{  
         "name":{  
            "type":"string"
         }
      }
   }
}

and

{  
   "$schema":"http://json-schema.org/draft-04/schema#",
   "oneOf":[  
      {  
         "type":"number"
      }
   ],
   "not":{  
      "type":"object",
      "properties":{  
         "name":{  
            "type":"string"
         }
      }
   }
}

I briefly debug through the code and the problem could be with the ToStringVisitor.visitNotSchema and is possible that only mustNotMatch should be passed there. But I may be wrong.

erosb added a commit that referenced this issue Nov 29, 2019
@erosb
Copy link
Contributor

erosb commented Nov 29, 2019

Hello, thank you for reporting it, it is now fixed in 51915dd

@erosb erosb closed this as completed Nov 29, 2019
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

2 participants