Skip to content

JSON schema validation with references to other schemas #557

Answered by danielaparker
nicomuns asked this question in Q&A
Discussion options

You must be logged in to vote

Here's a minimalistic example that shows how to pass the root directory as a command line argument. It should work with both the latest release, 0.178.0, and master, which will be released as 1.0.0.

#include <jsoncons/json.hpp>
#include <jsoncons_ext/jsonschema/jsonschema.hpp>
#include <iostream>
#include <strstream>

std::string main_schema = R"(
{
    "$id" : "https://my_domain.com",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Title",
    "type": "object",
    "properties": {
        "my_prop": { "$ref": "dir1/other.schema.json" },
        "my_other_prop": { "$ref": "dir2/foo/bar/baz/main.schema.json" },
        "$version": { "type": "integer" }
    },
    "a…

Replies: 5 comments 11 replies

Comment options

You must be logged in to vote
3 replies
@nicomuns
Comment options

@danielaparker
Comment options

@nicomuns
Comment options

Comment options

You must be logged in to vote
2 replies
@nicomuns
Comment options

@danielaparker
Comment options

Comment options

You must be logged in to vote
3 replies
@nicomuns
Comment options

@danielaparker
Comment options

@nicomuns
Comment options

Answer selected by nicomuns
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@nicomuns
Comment options

@danielaparker
Comment options

@nicomuns
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants