Skip to content

Validate JSON repr against JSON schema #38

@sim642

Description

@sim642

I was looking for an OCaml library to validate Yojson objects against a JSON schema and this library looks like the only one remotely related to that task. Unfortunately, I cannot figure out how to do it and am not suspecting it's not actually provided as a feature.

Json_schema does allow parsing JSON schemas from JSON objects themselves. Json_encoding implements all the validation rules, but that's on statically typed encodings, not arbitrary runtime schemas, which is what I want.
But there doesn't seem to be a way to convert a Json_schema.schema to any kind of Json_encoding.encoding, which would actually validate objects against the schema when destructing. There's custom, but that just stores the schema without checking.

Am I missing something or is it impossible to use this library for arbitrary schema validation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions