Skip to content

Commit

Permalink
Squashed 'src/Valijson/valijson/' changes from 7a52fc88..2dfc7499
Browse files Browse the repository at this point in the history
2dfc7499 Update Authors file
6dab4978 Update README and tweak syntax in Boost.JSON adapter
2ecd2119 Merge pull request microsoft#136 from matty0ung/boostjson
b1119ccc Merge pull request microsoft#135 from matty0ung/uris
f5cf601e Add Boost.JSON support
14325788 Add Boost.JSON support
d3104ea8 Support fetching sub-schemas from other files
ad7dac75 Merge pull request microsoft#133 from rayvincent2/feature/add-urn-reference-support
3442709a Update urn regex expression to be std::regex safe
f787a8a7 Update urn regex to match widely accepted expression
653d515d Ensure that urn regex checks to end of string
eac0859c Ensure that urn NID cannot include '.'
ef42dae2 Add support for urn document references
a4684c28 Fix path to rapidjson in fuzzing test code
11af6522 Merge remote-tracking branch 'clainio/build-fix'
c5487c39 Update rapidjson to latest code from github
6a04040d Update adapters to avoid inheriting from std::iterator
385d2d83 Improve handling of compiler flags when exceptions are disabled
82e093fe Upgrade gtest to v1.11.0
c63ac26f Disable C4702: unreachable code warnings for json_pointer.hpp
855365bc Disable C4702: unreachable code warnings within relevant headers
5c97e3cc Fix gcc build error
4897d102 Fix exclusiveMaximum and exclusiveMinimum error messages
6cc4cddc Suppress boost warnings that aren't relevant to the test suite
2cf8d3dd Add default tests for draft 7
e94179e1 Add definitions tests for draft 7
bb2c4251 Improve array_iteration_basics example
e6909b15 Add required test for draft 4
df89869e Add maxLength and minLength tests for draft 7
91834621 Fix return type on getMinLength
3740dc51 Explicitly initialise optionals in Subschema class
cb778b6b Minor changes to address msvc warnings and make cmake work on Windows
70f12ed1 Merge pull request microsoft#123 from anishmonachan7/fix_unused_variable
03b8cccb Update include/valijson/constraints/concrete_constraints.hpp
dc6d2fe0 fix unused variable error with gcc 8.3
77bae9fb Fix xcode stuff
66262baf Include nlohmann/json.hpp instead of json.hpp
b3b958c8 Merge pull request microsoft#121 from anishmonachan7/virtual_destructor
84c9fbf5 destructor to virtual destructor
8a784f23 Minor fix for example code in README
a19e1c00 Remove warning suppressions for clang
af2358b6 Use custom RAPIDJSON_ASSERT macro to catch parser errors
7ab96207 Ensure ref values are strings
635f36f0 Merge pull request microsoft#119 from BSipos-RKF/issue-118
fba5a9e8 Reject JSON references that index into empty arrays
cbcde15c Possible fix for microsoft#118
3621f98d Update rapidjson_utils.hpp to use iterative parsing
f544cd02 Merge pull request microsoft#116 from AdamKorcz/fuzz1
c13eed99 Minor refactoring
3a47f0cd Added fuzzer with oss-fuzz build file
cf648930 Merge pull request microsoft#114 from baylesj/fix-memory-leak
1f964c12 Fix memory leak in concrete constraints
7cb31947 Merge pull request microsoft#113 from hei-pa/master
8cc83c8b move curlpp findPackage in EXAMPLES block
c1e75c70 Merge pull request microsoft#110 from baylesj/remote_throws
bc81adbd add version checks around BOOST_NORETURN
7a560db2 Fixup headers
b8e95810 Apply feedback, add boost version check
8f6f9b6a Use deprecated declarations
f1006142 Cleanup unnecessary returns
a30ef974 Add VALIJSON_USE_EXCEPTIONS mode
8a700811 Add JSON Inspector example app
bbfc3f5c Fixed build on certain GCC toolchains
84b67fa6 Merge pull request microsoft#107 from baylesj/readme
90783ca4 Minor code style changes
3dd4482a Merge pull request microsoft#103 from wwriter/cond_schema_errormessage
ee4f85bf Minor tweaks to README.md file
a7038862 Update jsoncpp link in readme
abedaf0e Merge pull request microsoft#105 from baylesj/update-jsoncpp
825ee110 Fix readme
b6b6f167 Delete jsoncpp fuzzing stuff
2ee7474f Delete more unnecessary scripts
1ff5308f fix submodule
dbc4fcc8 Remove modules
88d9d890 Update JsonCpp to 1.9.4
d5091b2d added feature : now users can get a detailed error message when if-then-else conditional constraints are not met
931f64d4 Merge pull request microsoft#102 from mathbunnyru/patch-2
c5e61543 Add conan package manager info
6cda9227 Merge pull request microsoft#99 from mathbunnyru/patch-1
45b0f83b Fix README so the code actually throws, when json is invalid
89e37cbf Fix typo
7f01c391 Minor suggestions from clangtidy
a527564b Merge pull request microsoft#96 from joshuaeckroth/master
ccad6b14 Switched from jsoncpp deprecated Reader to CharReader
45a333e6 Try to make builds faster
0ee3bada Fix broken build
bbe62ecd Merge pull request microsoft#95 from wirenboard/feature/cache-regex
f7f3acf2 Merge pull request microsoft#94 from wirenboard/fix/pass-by-ref
39f35069 Regex objects cache for pattern constraints
2216c2b8 Pass visitor to validationCallback by ref
0db0d139 Merge pull request microsoft#93 from Delgan/fix-unused-args
1c825cc6 Remove unused parameters instead of commenting them out
ca031221 Fix compilation errors due to unused parameters
105e345a Merge pull request microsoft#92 from arthurafarias/add-cmake-interface-library
f60a3089 Added interface target to CMakeLists.txt
d453ee2e Revert breaking changes to jsoncpp_adapter.hpp
f3a0390e Revert changes to json11_adapter.hpp
49c20301 Disable -Wshadow for included header in property_tree_utils.hpp
8875d802 Add CLion paths to .gitignore
73a8e440 More aggressive compiler warnings
77d2ef82 Cosmetic improvements for poco_json_adapter.hpp and property_tree_adapter.hpp
e5c1cbfe Ensure tests are run for Poco, Qt and property_tree adapters
8c0d16a0 Cosmetic improvements for std_string_adapter.hpp, test_json_pointer.cpp and test_poly_constraint.cpp
217b990b Cosmetic improvements for schema_parser.hpp and validation_results.hpp
71f4cdaa Cosmetic improvements for custom_allocator.hpp
e46af245 Cosmetic improvements for concrete_constraints.hpp and basic_constraint.hpp
7917b2f7 Cosmetic improvements for schema.hpp, schema_parser.hpp and subschema.hpp
8150a520 Cosmetic improvements for test_adapter_comparison.cpp
28cc9e8e Cosmetic improvements for qtjson_adapter.hpp
508bc019 Cosmetic improvements for rapidjson_adapter.hpp
d7901d48 Cosmetics improvements for picojson_adapter.hpp
3211a04d Cosmetic improvements for nlohmann_json_adapter.hpp
0f57cb31 Cosmetic improvements for jsoncpp_adapter.hpp
e11c17c3 Cosmetic improvements for json11_adapter.hpp
6f1f4acb Cosmetic improvements for basic_adapter.hpp
3ddbe585 Cosmetic improvements for validation_visitor.hpp
09d21423 Update xcode project files
0481a0bb Minor tidy up of const auto usage
94cef2fa Add example showing local file resolution

git-subtree-dir: src/Valijson/valijson
git-subtree-split: 2dfc7499a31b84edef71189f4247919268ebc74e
  • Loading branch information
jedieaston committed Nov 17, 2021
1 parent eeca649 commit 9f4ae89
Show file tree
Hide file tree
Showing 495 changed files with 90,077 additions and 111,954 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ xcode/valijson.xcodeproj/project.xcworkspace
xcode/valijson.xcodeproj/project.xcworkspace/xcuserdata
xcode/valijson.xcodeproj/xcuserdata
doc/html
.idea
cmake-build-*
CMakeFiles/
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ before_install:
- export POCO_OPTS="$POCO_OPTS -DENABLE_MONGODB=off -DENABLE_NET=off -DENABLE_NETSSL=off -DENABLE_PAGECOMPILER=off"
- export POCO_OPTS="$POCO_OPTS -DENABLE_PAGECOMPILER_FILE2PAGE=off -DENABLE_PDF=off -DENABLE_UTIL=off -DENABLE_XML=off -DENABLE_ZIP=off"
- cmake -D CMAKE_CXX_COMPILER=`which ${CXX_COMPILER}` -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" $POCO_OPTS ..
- sudo make install
- sudo make -j 4 install
- wget -O curlpp-0.8.1.tar.gz https://github.com/jpbarrette/curlpp/archive/v0.8.1.tar.gz
- tar -xf curlpp-0.8.1.tar.gz
- cd curlpp-0.8.1
- mkdir cmake_build
- cd cmake_build
- cmake -D CMAKE_CXX_COMPILER=`which ${CXX_COMPILER}` -DCMAKE_CXX_FLAGS="$CMAKE_CXX_FLAGS" -DCMAKE_EXE_LINKER_FLAGS="$CMAKE_EXE_LINKER_FLAGS" ..
- sudo make install
- sudo make -j 4 install
- popd

script:
Expand Down
6 changes: 6 additions & 0 deletions Authors
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,9 @@ Pierre Lamot, [email protected]

drewxa (github username), [email protected]
Adapter for Poco JSON parser

Jordan Bayles (jophba), [email protected]
JsonCpp owner

Matt Young (matty0ung), <[email protected]>
Adapter for Boost.JSON parser library
122 changes: 89 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,33 @@ option(valijson_INSTALL_HEADERS "Install valijson headers." FALSE)
option(valijson_BUILD_EXAMPLES "Build valijson examples." FALSE)
option(valijson_BUILD_TESTS "Build valijson test suite." TRUE)
option(valijson_EXCLUDE_BOOST "Exclude Boost when building test suite." FALSE)
option(valijson_USE_EXCEPTIONS "Use exceptions in valijson and included libs." TRUE)

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
if(MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
else()
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(!COMPILER_SUPPORTS_CXX11)
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()

# Suppress boost warnings that aren't relevant to the test suite
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_BIND_GLOBAL_PLACEHOLDERS")

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
endif()

add_library(valijson INTERFACE)
# create alias, so that user could always write target_link_libraries(... ValiJSON::valijson)
# despite of valijson target is imported or not
add_library(ValiJSON::valijson ALIAS valijson)

include(GNUInstallDirs)
target_include_directories(valijson INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

if(valijson_INSTALL_HEADERS)
install(DIRECTORY include/ DESTINATION include)
Expand All @@ -18,29 +43,27 @@ if(NOT valijson_BUILD_TESTS AND NOT valijson_BUILD_EXAMPLES)
return()
endif()

SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
if(valijson_USE_EXCEPTIONS)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=1)
else()
message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
add_definitions(-D_HAS_EXCEPTIONS=0)
add_definitions(-DBOOST_NO_EXCEPTIONS)
add_definitions(-DJSON_USE_EXCEPTION=0)
add_definitions(-DVALIJSON_USE_EXCEPTIONS=0)
endif()

find_package(curlpp)
find_package(Poco OPTIONAL_COMPONENTS JSON)
find_package(Qt5Core)

# jsoncpp library
add_library(jsoncpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_reader.cpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_value.cpp
thirdparty/jsoncpp-0.9.4/src/lib_json/json_writer.cpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_reader.cpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_value.cpp
thirdparty/jsoncpp-1.9.4/src/lib_json/json_writer.cpp
)

target_include_directories(jsoncpp SYSTEM PRIVATE thirdparty/jsoncpp-0.9.4/include)
set_target_properties(jsoncpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/jsoncpp-0.9.4)
target_include_directories(jsoncpp SYSTEM PRIVATE thirdparty/jsoncpp-1.9.4/include)
set_target_properties(jsoncpp PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/thirdparty/jsoncpp-1.9.4)

add_library(json11
thirdparty/json11-ec4e452/json11.cpp
Expand All @@ -51,10 +74,10 @@ set_target_properties(json11 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINAR

# Not all of these are required for examples build it doesn't hurt to include them
include_directories(include SYSTEM
thirdparty/gtest-1.7.0/include
thirdparty/gtest-1.11.0/include
thirdparty/json11-ec4e452
thirdparty/jsoncpp-0.9.4/include
thirdparty/rapidjson-1.1.0/include
thirdparty/jsoncpp-1.9.4/include
thirdparty/rapidjson-48fbd8c/include
thirdparty/picojson-1.3.0
thirdparty/nlohmann-json-3.1.2
)
Expand All @@ -66,11 +89,14 @@ if(valijson_BUILD_TESTS)

# Build local gtest
set(gtest_force_shared_crt ON)
add_subdirectory(thirdparty/gtest-1.7.0)
option(BUILD_GMOCK FALSE)
option(INSTALL_GTEST FALSE)
add_subdirectory(thirdparty/gtest-1.11.0)

set(TEST_SOURCES
tests/test_adapter_comparison.cpp
tests/test_fetch_document_callback.cpp
tests/test_fetch_urn_document_callback.cpp
tests/test_fetch_absolute_uri_document_callback.cpp
tests/test_json_pointer.cpp
tests/test_json11_adapter.cpp
tests/test_jsoncpp_adapter.cpp
Expand All @@ -82,42 +108,68 @@ if(valijson_BUILD_TESTS)
tests/test_validator.cpp
)

set(TEST_LIBS gtest gtest_main jsoncpp json11)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_boost_json_adapter.cpp)
list(APPEND TEST_SOURCES tests/test_property_tree_adapter.cpp)
endif()

if(Poco_FOUND)
include_directories(${Poco_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_poco_json_adapter.cpp)
list(APPEND TEST_LIBS ${Poco_Foundation_LIBRARIES} ${Poco_JSON_LIBRARIES})
endif()

if(Qt5Core_FOUND)
include_directories(${Qt5Core_INCLUDE_DIRS})
list(APPEND TEST_LIBS Qt5::Core)
list(APPEND TEST_SOURCES tests/test_qtjson_adapter.cpp)
endif()

# Unit tests executable
add_executable(test_suite ${TEST_SOURCES})
if(NOT valijson_USE_EXCEPTIONS)
if(MSVC)
if(CMAKE_CXX_FLAGS MATCHES "/EHsc ")
string(REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
target_compile_options(test_suite PUBLIC /EHs-c-)
endif()
else()
target_compile_options(test_suite PUBLIC -fno-exceptions)
endif()
endif()

if(NOT MSVC)
set_target_properties(test_suite PROPERTIES COMPILE_FLAGS " -pedantic -Werror -Wshadow -Wunused")
endif()

# Definition for using picojson
set_target_properties(test_suite PROPERTIES COMPILE_DEFINITIONS "PICOJSON_USE_INT64")

set(TEST_LIBS gtest gtest_main jsoncpp json11)

if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_property_tree_adapter.cpp)
add_definitions(-DBOOST_ALL_DYN_LINK)
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_PROPERTY_TREE_ADAPTER")
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_BOOST_ADAPTERS")
endif()

if(Poco_FOUND)
include_directories(${Poco_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_poco_json_adapter.cpp)
list(APPEND TEST_LIBS ${Poco_Foundation_LIBRARIES} ${Poco_JSON_LIBRARIES})
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_POCO_ADAPTER")
endif()

if(Qt5Core_FOUND)
include_directories(${Qt5Core_INCLUDE_DIRS})
list(APPEND TEST_SOURCES tests/test_qtjson_adapter.cpp)
list(APPEND TEST_LIBS Qt5::Core)
target_compile_definitions(test_suite PRIVATE "VALIJSON_BUILD_QT_ADAPTER")
endif()

target_link_libraries(test_suite ${TEST_LIBS} ${Boost_LIBRARIES})
endif()

if(valijson_BUILD_EXAMPLES)
find_package(curlpp)
include_directories(SYSTEM)

add_executable(custom_schema
Expand All @@ -144,14 +196,18 @@ if(valijson_BUILD_EXAMPLES)
examples/json_pointers.cpp
)

add_executable(remote_resolution_local_file
examples/remote_resolution_local_file.cpp
)

if(curlpp_FOUND)
include_directories(${curlpp_INCLUDE_DIR})

add_executable(remote_resolution
examples/remote_resolution.cpp
add_executable(remote_resolution_url
examples/remote_resolution_url.cpp
)

target_link_libraries(remote_resolution curl ${curlpp_LIBRARIES})
target_link_libraries(remote_resolution_url curl ${curlpp_LIBRARIES})
endif()

target_link_libraries(custom_schema ${Boost_LIBRARIES})
Expand Down
Loading

0 comments on commit 9f4ae89

Please sign in to comment.