1. Dan Cutting
  2. VeriJSON
  3. Issues
Issue #1 resolved

schema format issues

Anonymous created an issue

VeriJSON does not appear to parse schema generated by the http://www.jsonschema.net/ tool.

Perhaps I'm missing something?

Comments (7)

  1. Dan Cutting repo owner

    Hi, thanks for the issue report.

    Could you describe how you're trying to use JSON Schema with VeriJSON (maybe with some sample code or a sample project)?

    VeriJSON is an alternative to JSON Schema. It uses its own pattern template "language" to describe the expected format of a JSON document, and cannot use JSON Schemas directly. (See the top of the README at https://bitbucket.org/dcutting/verijson for a description/sample of VeriJSON's pattern language.)

  2. alex kent

    aha, perhaps I misunderstood. My goal is to verify, within unit tests, that the JSON output from my iOS app matches a schema file (which describes the JSON acceptable to the target API).

    I was hoping to use VeriJSON to do this. As… well, i haven't come across any other obj-c JSON validators!

  3. alex kent

    Also, I already have the target JSON schema files (in the IETF JSON schema format), they are large enough to discourage me from re-creating them in an alternative format.

  4. Dan Cutting repo owner

    Hi Alex,

    The original intent of VeriJSON was to check that JSON received over the wire was in some expected format before trying to pull values from it. In principle, it should also be able to validate JSON created by your app in unit tests, but it isn't designed to work with JSON Schema files, just VeriJSON patterns.

    So to do this you would need to convert your JSON Schema files to VeriJSON patterns. However, VeriJSON patterns are less expressive than JSON Schema files so this may not be possible without losing some of the semantics you're trying to validate. (The advantage of VeriJSON patterns is they're simpler to read and write, IMO.)

    I didn't find any JSON Schema libraries for Objective-C either, and after flipping through the spec I decided I didn't need something quite that complicated: hence VeriJSON. Sorry that doesn't really help in this case! :)

  5. alex kent

    Thanks for the explanation. I will consider my options. Most likely I'll conver the JSON schema files I have to VeriJSON style… that's probably still quite a useful test, and less work than implementing a JSON schema validator in obj-c. Thanks again.

  6. Log in to comment