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/json-c.wrap b/subprojects/json-c.wrap
index aca2cef..e68e6ef 100644
--- a/subprojects/json-c.wrap
+++ b/subprojects/json-c.wrap
@@ -1,14 +1,7 @@
-[wrap-file]
-directory = json-c-0.18
-source_url = https://s3.amazonaws.com/json-c_releases/releases/json-c-0.18.tar.gz
-source_filename = json-c-0.18.tar.gz
-source_hash = 876ab046479166b869afc6896d288183bbc0e5843f141200c677b3e8dfb11724
-patch_filename = json-c_0.18-1_patch.zip
-patch_url = https://wrapdb.mesonbuild.com/v2/json-c_0.18-1/get_patch
-patch_hash = c9d2c0449a9686755445cd18d7cff597f21e418e11a786441de7b8947ff43798
-source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/json-c_0.18-1/json-c-0.18.tar.gz
-wrapdb_version = 0.18-1
+[wrap-git]
+revision = json-c-0.18-20240915
+url = https://github.com/json-c/json-c.git
+patch_directory = json-c
 
 [provide]
 json-c = json_c_dep
-
diff --git a/subprojects/jsoncdac.wrap b/subprojects/jsoncdac.wrap
new file mode 100644
index 0000000..e2636a1
--- /dev/null
+++ b/subprojects/jsoncdac.wrap
@@ -0,0 +1,8 @@
+[wrap-git]
+revision = HEAD
+url = https://github.com/domoslabs/jsonc-daccord.git
+patch_directory = jsoncdac
+
+[provide]
+jsoncdac = jsoncdac_dep
+
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'),
+)