Json daccor
json daccor is a json-schema validation library that accepts json-c
objects as input, and seems to be designed for openwrt, a system
with very similar requirements to BMCs.
Using this library has several motivations. First, it keeps
libcper as a C application so integrations aren't required to provide
a c++ toolchain to be able to run unit tests.
Next, it means that we avoid an "expensive" conversion in unit tests
from json-c -> nlohmann just so we can use a third library, valijson
In terms of dependency count, it drops one dependency.
(nlohmann+valijson) to (json daccor)
Finally, it means that in the future versions of the library, we
can allow json-schema verification as an option in the library
itself, which would allow us to give a CLI option for verifying
schema on any arbitrary output (helping in debugging).
Testing to see if it will work and what improvements it makes
Change-Id: I1c00bf2ef9b898b2e5decd90b749c784fb4de109
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/subprojects/packagefiles/jsoncdac/meson.build b/subprojects/packagefiles/jsoncdac/meson.build
new file mode 100644
index 0000000..6cc3bfc
--- /dev/null
+++ b/subprojects/packagefiles/jsoncdac/meson.build
@@ -0,0 +1,59 @@
+project(
+ 'libjsoncdac',
+ ['c'],
+ meson_version: '>=1.1.1',
+ default_options: ['default_library=static', 'c_std=gnu23'],
+)
+conf_data = configuration_data(
+ {
+ 'PROJECT_NAME': 'jsoncdac',
+ 'PROJECT_VERSION': '0.1',
+ 'PROJECT_VERSION_MAJOR': '0',
+ 'PROJECT_VERSION_MINOR': '1',
+ 'PROJECT_VERSION_PATCH': '0',
+ },
+)
+configure_file(
+ input: 'config.h.in',
+ output: 'version_config.h',
+ configuration: conf_data,
+)
+deps = []
+
+add_project_arguments('-Wno-unused-parameter', language: 'c')
+add_project_arguments('-Wformat=0', language: 'c')
+
+jsonc = dependency('json-c')
+deps += jsonc
+
+jsoncdac_sources = files(
+ 'libjsoncdac/additionalproperties.c',
+ 'libjsoncdac/contains.c',
+ 'libjsoncdac/dependent.c',
+ #'libjsoncdac/download.c',
+ #'libjsoncdac/jdac-cli.c',
+ 'libjsoncdac/output.c',
+ 'libjsoncdac/pattern.c',
+ 'libjsoncdac/patternproperties.c',
+ 'libjsoncdac/propertynames.c',
+ 'libjsoncdac/ref.c',
+ 'libjsoncdac/regex_match.c',
+ 'libjsoncdac/store.c',
+ 'libjsoncdac/subschemalogic.c',
+ 'libjsoncdac/validate.c',
+)
+
+jsoncdac_deps = [dependency('json-c')]
+cc = meson.get_compiler('c')
+m_dep = cc.find_library('m', required: false)
+if m_dep.found()
+ deps += m_dep
+endif
+
+jsoncdac = library('jsoncdac', jsoncdac_sources, dependencies: deps)
+
+jsoncdac_dep = declare_dependency(
+ link_with: jsoncdac,
+ dependencies: deps,
+ include_directories: include_directories('include'),
+)