[json-schema-validator] Update to 2.2.0 (#29253)

* Update json-schema-validator to 2.2.0

* Update CI baseline

* Tweak description

* Update CI baseline

* Remove patch, address code review suggestions

* Update CI baseline

---------

Co-authored-by: chausner <chausner@users.noreply.github.com>
This commit is contained in:
chausner 2023-01-31 22:26:42 +01:00 committed by GitHub
parent 0fb75abb60
commit 25ed5f7cca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 85 deletions

View File

@ -1,36 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c4cc218..ff2b706 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,6 +8,8 @@ cmake_minimum_required(VERSION 3.2)
option(BUILD_TESTS "Build tests" ON)
option(BUILD_EXAMPLES "Build examples" ON)
+find_package(nlohmann_json CONFIG REQUIRED)
+
# the library
add_library(nlohmann_json_schema_validator
src/json-schema-draft7.json.cpp
@@ -34,6 +36,13 @@ set_target_properties(nlohmann_json_schema_validator
# because of the dependency to nlohmann_json.
set(JSON_VALIDATOR_INSTALL ON)
+target_link_libraries(
+ nlohmann_json_schema_validator
+ PUBLIC
+ nlohmann_json
+ nlohmann_json::nlohmann_json)
+
+if(0)
# here we decice how nlohmann::json is found and used to build this project
# first, check whether a nlohmann_json::nlohmann_json target exists already
@@ -92,7 +101,7 @@ else()
set(nlohmann_json_DIR ${JSON_HPP})
endif()
endif()
-
+endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
target_compile_options(nlohmann_json_schema_validator

View File

@ -1,13 +0,0 @@
diff --git a/src/json-validator.cpp b/src/json-validator.cpp
index f16f3ef..1f7b615 100644
--- a/src/json-validator.cpp
+++ b/src/json-validator.cpp
@@ -663,7 +663,7 @@ public:
#ifndef NO_STD_REGEX
attr = sch.find("pattern");
if (attr != sch.end()) {
- patternString_ = attr.value();
+ patternString_ = attr.value().get<std::string>();
pattern_ = {true, REGEX_NAMESPACE::regex(attr.value().get<std::string>(),
REGEX_NAMESPACE::regex::ECMAScript)};
sch.erase(attr);

View File

@ -1,14 +0,0 @@
diff --git a/nlohmann_json_schema_validatorConfig.cmake.in b/nlohmann_json_schema_validatorConfig.cmake.in
index 6ee0df2..e0315fa 100644
--- a/nlohmann_json_schema_validatorConfig.cmake.in
+++ b/nlohmann_json_schema_validatorConfig.cmake.in
@@ -7,6 +7,9 @@
get_filename_component(NLOHMANN_JSON_SCHEMA_VALIDATOR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(NLOHMANN_JSON_SCHEMA_VALIDATOR_INCLUDE_DIRS @CONF_INCLUDE_DIRS@)
+include(CMakeFindDependencyMacro)
+find_dependency(nlohmann_json)
+
# Our library dependencies (contains definitions for IMPORTED targets)
if(NOT TARGET json-schema-validator)
include("${NLOHMANN_JSON_SCHEMA_VALIDATOR_CMAKE_DIR}/nlohmann_json_schema_validatorTargets.cmake")

View File

@ -1,30 +1,26 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO pboettch/json-schema-validator
REF 27fc1d094503623dfe39365ba82581507524545c
SHA512 4fd05087743f43871586a53d119acd1a19d0bdec8a5620f62b6eee7a926d285842e8439127eec52eeb11069c92b8d9af28558897d48e2422ecafca39d9f23cdb
REF "${VERSION}"
SHA512 8d7fe6775774040099aa8d8b10fa18c4ccebe4437ecf9670710a0f64443d3588ca3e1bf1bc32a800518b748aa3acd89ecc61d1568b6dd8bf54273b33c5ab5d5a
HEAD_REF master
PATCHES
fix-ambiguous-assignment.patch
cmake-find-package.patch
forward-find-package.patch
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_TESTS=OFF
-DBUILD_EXAMPLES=OFF
-DJSON_VALIDATOR_BUILD_TESTS=OFF
-DJSON_VALIDATOR_BUILD_EXAMPLES=OFF
)
vcpkg_install_cmake()
vcpkg_cmake_install()
set(PKG_NAME "nlohmann_json_schema_validator")
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/${PKG_NAME} TARGET_PATH share/${PKG_NAME})
vcpkg_cmake_config_fixup(PACKAGE_NAME nlohmann_json_schema_validator CONFIG_PATH lib/cmake/nlohmann_json_schema_validator)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
vcpkg_copy_pdbs()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

View File

@ -1,13 +1,21 @@
{
"name": "json-schema-validator",
"version-string": "2.1.0",
"port-version": 1,
"description": "This is a C++ library for validating JSON documents based on a JSON Schema. This validator is based on nlohmann json library.",
"version": "2.2.0",
"description": "C++ library for validating JSON documents based on a JSON Schema. This validator is based on the nlohmann-json library.",
"homepage": "https://github.com/pboettch/json-schema-validator",
"license": "MIT",
"dependencies": [
{
"name": "nlohmann-json",
"default-features": false
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -3281,8 +3281,8 @@
"port-version": 0
},
"json-schema-validator": {
"baseline": "2.1.0",
"port-version": 1
"baseline": "2.2.0",
"port-version": 0
},
"json-spirit": {
"baseline": "4.1.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "968aee6b22bf2b1248b38ae25aed43a1760fec0d",
"version": "2.2.0",
"port-version": 0
},
{
"git-tree": "361dde90ee9e81d84ad0e87d75f16e4f9f662b88",
"version-string": "2.1.0",