Loading [MathJax]/extensions/tex2jax.js
Plugins
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
json_schema_validator.hpp
Go to the documentation of this file.
1/*
2 * JSON schema validator for JSON for modern C++
3 *
4 * Copyright (c) 2016-2019 Patrick Boettcher <p@yai.se>.
5 *
6 * SPDX-License-Identifier: MIT
7 *
8 */
9
10#ifndef __H__UG__JSON_SCHEMA_VALIDATOR_HPP__
11#define __H__UG__JSON_SCHEMA_VALIDATOR_HPP__
12
13#include <nlohmann/json-schema.hpp>
14
15#include <fstream>
16#include <iostream>
17
18#include "ug.h"
19#include "common/error.h"
20#include "common/log.h"
22
23
24
25
26
27
28
29namespace ug
30{
31 namespace JSONToolkit
32 {
33
34 struct JSONSchemaValidator : public nlohmann::json_schema::json_validator
35 {
36
37 typedef nlohmann::json_schema::json_validator base_type;
38
40
42
44 void init(nlohmann::json& schema);
45
47 bool validate_document(nlohmann::json& document);
48
49 };
50
51 } // namespace JSONToolkit
52
53} // namespace ug
54
55#endif // __H__UG__JSON_SCHEMA_VALIDATOR_HPP__
Definition json_schema_validator.hpp:35
bool validate_document(nlohmann::json &document)
Do the actual validation of the document.
Definition json_schema_validator.cpp:68
~JSONSchemaValidator()
Definition json_schema_validator.hpp:41
nlohmann::json_schema::json_validator base_type
Definition json_schema_validator.hpp:37
JSONSchemaValidator()
Definition json_schema_validator.cpp:48
void init(nlohmann::json &schema)
Set root.
Definition json_schema_validator.cpp:53