├── .gitattributes
├── .gitignore
├── .gitmodules
├── .travis.yml
├── CHANGELOG.md
├── CMakeLists.txt
├── CMakeModules
└── FindGTestSrc.cmake
├── RapidJSON.pc.in
├── RapidJSONConfig.cmake.in
├── RapidJSONConfigVersion.cmake.in
├── appveyor.yml
├── bin
├── data
│ ├── abcde.txt
│ ├── glossary.json
│ ├── menu.json
│ ├── readme.txt
│ ├── sample.json
│ ├── webapp.json
│ └── widget.json
├── draft-04
│ └── schema
├── encodings
│ ├── utf16be.json
│ ├── utf16bebom.json
│ ├── utf16le.json
│ ├── utf16lebom.json
│ ├── utf32be.json
│ ├── utf32bebom.json
│ ├── utf32le.json
│ ├── utf32lebom.json
│ ├── utf8.json
│ └── utf8bom.json
├── jsonchecker
│ ├── fail1.json
│ ├── fail10.json
│ ├── fail11.json
│ ├── fail12.json
│ ├── fail13.json
│ ├── fail14.json
│ ├── fail15.json
│ ├── fail16.json
│ ├── fail17.json
│ ├── fail18.json
│ ├── fail19.json
│ ├── fail2.json
│ ├── fail20.json
│ ├── fail21.json
│ ├── fail22.json
│ ├── fail23.json
│ ├── fail24.json
│ ├── fail25.json
│ ├── fail26.json
│ ├── fail27.json
│ ├── fail28.json
│ ├── fail29.json
│ ├── fail3.json
│ ├── fail30.json
│ ├── fail31.json
│ ├── fail32.json
│ ├── fail33.json
│ ├── fail4.json
│ ├── fail5.json
│ ├── fail6.json
│ ├── fail7.json
│ ├── fail8.json
│ ├── fail9.json
│ ├── pass1.json
│ ├── pass2.json
│ ├── pass3.json
│ └── readme.txt
├── jsonschema
│ ├── .gitignore
│ ├── .travis.yml
│ ├── LICENSE
│ ├── README.md
│ ├── bin
│ │ └── jsonschema_suite
│ ├── remotes
│ │ ├── folder
│ │ │ └── folderInteger.json
│ │ ├── integer.json
│ │ └── subSchemas.json
│ ├── tests
│ │ ├── draft3
│ │ │ ├── additionalItems.json
│ │ │ ├── additionalProperties.json
│ │ │ ├── default.json
│ │ │ ├── dependencies.json
│ │ │ ├── disallow.json
│ │ │ ├── divisibleBy.json
│ │ │ ├── enum.json
│ │ │ ├── extends.json
│ │ │ ├── items.json
│ │ │ ├── maxItems.json
│ │ │ ├── maxLength.json
│ │ │ ├── maximum.json
│ │ │ ├── minItems.json
│ │ │ ├── minLength.json
│ │ │ ├── minimum.json
│ │ │ ├── optional
│ │ │ │ ├── bignum.json
│ │ │ │ ├── format.json
│ │ │ │ ├── jsregex.json
│ │ │ │ └── zeroTerminatedFloats.json
│ │ │ ├── pattern.json
│ │ │ ├── patternProperties.json
│ │ │ ├── properties.json
│ │ │ ├── ref.json
│ │ │ ├── refRemote.json
│ │ │ ├── required.json
│ │ │ ├── type.json
│ │ │ └── uniqueItems.json
│ │ └── draft4
│ │ │ ├── additionalItems.json
│ │ │ ├── additionalProperties.json
│ │ │ ├── allOf.json
│ │ │ ├── anyOf.json
│ │ │ ├── default.json
│ │ │ ├── definitions.json
│ │ │ ├── dependencies.json
│ │ │ ├── enum.json
│ │ │ ├── items.json
│ │ │ ├── maxItems.json
│ │ │ ├── maxLength.json
│ │ │ ├── maxProperties.json
│ │ │ ├── maximum.json
│ │ │ ├── minItems.json
│ │ │ ├── minLength.json
│ │ │ ├── minProperties.json
│ │ │ ├── minimum.json
│ │ │ ├── multipleOf.json
│ │ │ ├── not.json
│ │ │ ├── oneOf.json
│ │ │ ├── optional
│ │ │ ├── bignum.json
│ │ │ ├── format.json
│ │ │ └── zeroTerminatedFloats.json
│ │ │ ├── pattern.json
│ │ │ ├── patternProperties.json
│ │ │ ├── properties.json
│ │ │ ├── ref.json
│ │ │ ├── refRemote.json
│ │ │ ├── required.json
│ │ │ ├── type.json
│ │ │ └── uniqueItems.json
│ └── tox.ini
├── types
│ ├── alotofkeys.json
│ ├── booleans.json
│ ├── floats.json
│ ├── guids.json
│ ├── integers.json
│ ├── mixed.json
│ ├── nulls.json
│ ├── paragraphs.json
│ └── readme.txt
└── unittestschema
│ ├── address.json
│ ├── allOf_address.json
│ ├── anyOf_address.json
│ ├── idandref.json
│ └── oneOf_address.json
├── contrib
└── natvis
│ ├── LICENSE
│ ├── README.md
│ └── rapidjson.natvis
├── doc
├── CMakeLists.txt
├── Doxyfile.in
├── Doxyfile.zh-cn.in
├── diagram
│ ├── architecture.dot
│ ├── architecture.png
│ ├── insituparsing.dot
│ ├── insituparsing.png
│ ├── iterative-parser-states-diagram.dot
│ ├── iterative-parser-states-diagram.png
│ ├── makefile
│ ├── move1.dot
│ ├── move1.png
│ ├── move2.dot
│ ├── move2.png
│ ├── move3.dot
│ ├── move3.png
│ ├── normalparsing.dot
│ ├── normalparsing.png
│ ├── simpledom.dot
│ ├── simpledom.png
│ ├── tutorial.dot
│ ├── tutorial.png
│ ├── utilityclass.dot
│ └── utilityclass.png
├── dom.md
├── dom.zh-cn.md
├── encoding.md
├── encoding.zh-cn.md
├── faq.md
├── faq.zh-cn.md
├── features.md
├── features.zh-cn.md
├── internals.md
├── internals.zh-cn.md
├── logo
│ ├── rapidjson.png
│ └── rapidjson.svg
├── misc
│ ├── DoxygenLayout.xml
│ ├── doxygenextra.css
│ ├── footer.html
│ └── header.html
├── npm.md
├── performance.md
├── performance.zh-cn.md
├── pointer.md
├── pointer.zh-cn.md
├── sax.md
├── sax.zh-cn.md
├── schema.md
├── schema.zh-cn.md
├── stream.md
├── stream.zh-cn.md
├── tutorial.md
└── tutorial.zh-cn.md
├── docker
└── debian
│ └── Dockerfile
├── example
├── CMakeLists.txt
├── archiver
│ ├── archiver.cpp
│ ├── archiver.h
│ └── archivertest.cpp
├── capitalize
│ └── capitalize.cpp
├── condense
│ └── condense.cpp
├── filterkey
│ └── filterkey.cpp
├── filterkeydom
│ └── filterkeydom.cpp
├── jsonx
│ └── jsonx.cpp
├── lookaheadparser
│ └── lookaheadparser.cpp
├── messagereader
│ └── messagereader.cpp
├── parsebyparts
│ └── parsebyparts.cpp
├── pretty
│ └── pretty.cpp
├── prettyauto
│ └── prettyauto.cpp
├── schemavalidator
│ └── schemavalidator.cpp
├── serialize
│ └── serialize.cpp
├── simpledom
│ └── simpledom.cpp
├── simplepullreader
│ └── simplepullreader.cpp
├── simplereader
│ └── simplereader.cpp
├── simplewriter
│ └── simplewriter.cpp
├── sortkeys
│ └── sortkeys.cpp
├── traverseaspointer.cpp
└── tutorial
│ └── tutorial.cpp
├── include
└── rapidjson
│ ├── allocators.h
│ ├── cursorstreamwrapper.h
│ ├── document.h
│ ├── encodedstream.h
│ ├── encodings.h
│ ├── error
│ ├── en.h
│ └── error.h
│ ├── filereadstream.h
│ ├── filewritestream.h
│ ├── fwd.h
│ ├── internal
│ ├── biginteger.h
│ ├── clzll.h
│ ├── diyfp.h
│ ├── dtoa.h
│ ├── ieee754.h
│ ├── itoa.h
│ ├── meta.h
│ ├── pow10.h
│ ├── regex.h
│ ├── stack.h
│ ├── strfunc.h
│ ├── strtod.h
│ └── swap.h
│ ├── istreamwrapper.h
│ ├── memorybuffer.h
│ ├── memorystream.h
│ ├── msinttypes
│ ├── inttypes.h
│ └── stdint.h
│ ├── ostreamwrapper.h
│ ├── pointer.h
│ ├── prettywriter.h
│ ├── rapidjson.h
│ ├── reader.h
│ ├── schema.h
│ ├── stream.h
│ ├── stringbuffer.h
│ ├── uri.h
│ └── writer.h
├── include_dirs.js
├── library.json
├── license.txt
├── package.json
├── rapidjson.autopkg
├── readme.md
├── readme.zh-cn.md
├── test
├── CMakeLists.txt
├── perftest
│ ├── CMakeLists.txt
│ ├── misctest.cpp
│ ├── perftest.cpp
│ ├── perftest.h
│ ├── platformtest.cpp
│ ├── rapidjsontest.cpp
│ └── schematest.cpp
├── unittest
│ ├── CMakeLists.txt
│ ├── allocatorstest.cpp
│ ├── bigintegertest.cpp
│ ├── clzlltest.cpp
│ ├── cursorstreamwrappertest.cpp
│ ├── documenttest.cpp
│ ├── dtoatest.cpp
│ ├── encodedstreamtest.cpp
│ ├── encodingstest.cpp
│ ├── filestreamtest.cpp
│ ├── fwdtest.cpp
│ ├── istreamwrappertest.cpp
│ ├── itoatest.cpp
│ ├── jsoncheckertest.cpp
│ ├── namespacetest.cpp
│ ├── ostreamwrappertest.cpp
│ ├── platformtest.cpp
│ ├── pointertest.cpp
│ ├── prettywritertest.cpp
│ ├── readertest.cpp
│ ├── regextest.cpp
│ ├── schematest.cpp
│ ├── simdtest.cpp
│ ├── strfunctest.cpp
│ ├── stringbuffertest.cpp
│ ├── strtodtest.cpp
│ ├── unittest.cpp
│ ├── unittest.h
│ ├── uritest.cpp
│ ├── valuetest.cpp
│ └── writertest.cpp
└── valgrind.supp
└── travis-doxygen.sh
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Set the default behavior, in case people don't have core.autocrlf set.
2 | * text=auto
3 |
4 | # Explicitly declare text files you want to always be normalized and converted
5 | # to native line endings on checkout.
6 | *.cpp text
7 | *.h text
8 | *.txt text
9 | *.md text
10 | *.cmake text
11 | *.svg text
12 | *.dot text
13 | *.yml text
14 | *.in text
15 | *.sh text
16 | *.autopkg text
17 | Dockerfile text
18 |
19 | # Denote all files that are truly binary and should not be modified.
20 | *.png binary
21 | *.jpg binary
22 | *.json binary
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/*
2 | !/bin/data
3 | !/bin/encodings
4 | !/bin/jsonchecker
5 | !/bin/types
6 | !/bin/unittestschema
7 | /build
8 | /doc/html
9 | /doc/doxygen_*.db
10 | *.a
11 |
12 | # Temporary files created during CMake build
13 | CMakeCache.txt
14 | CMakeFiles
15 | cmake_install.cmake
16 | CTestTestfile.cmake
17 | Makefile
18 | RapidJSON*.cmake
19 | RapidJSON.pc
20 | Testing
21 | /googletest
22 | install_manifest.txt
23 | Doxyfile
24 | Doxyfile.zh-cn
25 | DartConfiguration.tcl
26 | *.nupkg
27 |
28 | # Files created by OS
29 | *.DS_Store
30 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "thirdparty/gtest"]
2 | path = thirdparty/gtest
3 | url = https://github.com/google/googletest.git
4 |
--------------------------------------------------------------------------------
/CMakeModules/FindGTestSrc.cmake:
--------------------------------------------------------------------------------
1 |
2 | SET(GTEST_SEARCH_PATH
3 | "${GTEST_SOURCE_DIR}"
4 | "${CMAKE_CURRENT_LIST_DIR}/../thirdparty/gtest/googletest")
5 |
6 | IF(UNIX)
7 | IF(RAPIDJSON_BUILD_THIRDPARTY_GTEST)
8 | LIST(APPEND GTEST_SEARCH_PATH "/usr/src/gtest")
9 | ELSE()
10 | LIST(INSERT GTEST_SEARCH_PATH 1 "/usr/src/gtest")
11 | ENDIF()
12 | ENDIF()
13 |
14 | FIND_PATH(GTEST_SOURCE_DIR
15 | NAMES CMakeLists.txt src/gtest_main.cc
16 | PATHS ${GTEST_SEARCH_PATH})
17 |
18 |
19 | # Debian installs gtest include directory in /usr/include, thus need to look
20 | # for include directory separately from source directory.
21 | FIND_PATH(GTEST_INCLUDE_DIR
22 | NAMES gtest/gtest.h
23 | PATH_SUFFIXES include
24 | HINTS ${GTEST_SOURCE_DIR}
25 | PATHS ${GTEST_SEARCH_PATH})
26 |
27 | INCLUDE(FindPackageHandleStandardArgs)
28 | find_package_handle_standard_args(GTestSrc DEFAULT_MSG
29 | GTEST_SOURCE_DIR
30 | GTEST_INCLUDE_DIR)
31 |
--------------------------------------------------------------------------------
/RapidJSON.pc.in:
--------------------------------------------------------------------------------
1 | includedir=@INCLUDE_INSTALL_DIR@
2 |
3 | Name: @PROJECT_NAME@
4 | Description: A fast JSON parser/generator for C++ with both SAX/DOM style API
5 | Version: @LIB_VERSION_STRING@
6 | URL: https://github.com/Tencent/rapidjson
7 | Cflags: -I${includedir}
8 |
--------------------------------------------------------------------------------
/RapidJSONConfig.cmake.in:
--------------------------------------------------------------------------------
1 | @PACKAGE_INIT@
2 |
3 | include ("${CMAKE_CURRENT_LIST_DIR}/RapidJSON-targets.cmake")
4 |
5 | ################################################################################
6 | # RapidJSON source dir
7 | set( RapidJSON_SOURCE_DIR "@CONFIG_SOURCE_DIR@")
8 |
9 | ################################################################################
10 | # RapidJSON build dir
11 | set( RapidJSON_DIR "@CONFIG_DIR@")
12 |
13 | ################################################################################
14 | # Compute paths
15 | get_filename_component(RapidJSON_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
16 |
17 | get_target_property(RapidJSON_INCLUDE_DIR RapidJSON INTERFACE_INCLUDE_DIRECTORIES)
18 |
19 | set( RapidJSON_INCLUDE_DIRS ${RapidJSON_INCLUDE_DIR} )
20 |
21 | if(NOT TARGET rapidjson)
22 | add_library(rapidjson ALIAS RapidJSON)
23 | endif()
24 |
--------------------------------------------------------------------------------
/RapidJSONConfigVersion.cmake.in:
--------------------------------------------------------------------------------
1 | SET(PACKAGE_VERSION "@LIB_VERSION_STRING@")
2 |
3 | IF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
4 | SET(PACKAGE_VERSION_EXACT "true")
5 | ENDIF (PACKAGE_FIND_VERSION VERSION_EQUAL PACKAGE_VERSION)
6 | IF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
7 | SET(PACKAGE_VERSION_COMPATIBLE "true")
8 | ELSE (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
9 | SET(PACKAGE_VERSION_UNSUITABLE "true")
10 | ENDIF (NOT PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
11 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: 1.1.0.{build}
2 |
3 | configuration:
4 | - Debug
5 | - Release
6 |
7 | environment:
8 | matrix:
9 | # - VS_VERSION: 9 2008
10 | # VS_PLATFORM: win32
11 | # - VS_VERSION: 9 2008
12 | # VS_PLATFORM: x64
13 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
14 | VS_VERSION: 10 2010
15 | VS_PLATFORM: win32
16 | CXX11: OFF
17 | CXX17: OFF
18 | CXX20: OFF
19 | MEMBERSMAP: OFF
20 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
21 | VS_VERSION: 10 2010
22 | VS_PLATFORM: x64
23 | CXX11: OFF
24 | CXX17: OFF
25 | CXX20: OFF
26 | MEMBERSMAP: ON
27 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
28 | VS_VERSION: 11 2012
29 | VS_PLATFORM: win32
30 | CXX11: OFF
31 | CXX17: OFF
32 | CXX20: OFF
33 | MEMBERSMAP: ON
34 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
35 | VS_VERSION: 11 2012
36 | VS_PLATFORM: x64
37 | CXX11: OFF
38 | CXX17: OFF
39 | CXX20: OFF
40 | MEMBERSMAP: OFF
41 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
42 | VS_VERSION: 12 2013
43 | VS_PLATFORM: win32
44 | CXX11: OFF
45 | CXX17: OFF
46 | CXX20: OFF
47 | MEMBERSMAP: OFF
48 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
49 | VS_VERSION: 12 2013
50 | VS_PLATFORM: x64
51 | CXX11: OFF
52 | CXX17: OFF
53 | CXX20: OFF
54 | MEMBERSMAP: ON
55 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
56 | VS_VERSION: 14 2015
57 | VS_PLATFORM: win32
58 | CXX11: OFF
59 | CXX17: OFF
60 | CXX20: OFF
61 | MEMBERSMAP: ON
62 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
63 | VS_VERSION: 14 2015
64 | VS_PLATFORM: x64
65 | CXX11: OFF
66 | CXX17: OFF
67 | CXX20: OFF
68 | MEMBERSMAP: OFF
69 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
70 | VS_VERSION: 15 2017
71 | VS_PLATFORM: win32
72 | CXX11: OFF
73 | CXX17: OFF
74 | CXX20: OFF
75 | MEMBERSMAP: OFF
76 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
77 | VS_VERSION: 15 2017
78 | VS_PLATFORM: x64
79 | CXX11: OFF
80 | CXX17: OFF
81 | CXX20: OFF
82 | MEMBERSMAP: ON
83 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
84 | VS_VERSION: 15 2017
85 | VS_PLATFORM: x64
86 | CXX11: ON
87 | CXX17: OFF
88 | CXX20: OFF
89 | MEMBERSMAP: OFF
90 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
91 | VS_VERSION: 15 2017
92 | VS_PLATFORM: x64
93 | CXX11: OFF
94 | CXX17: ON
95 | CXX20: OFF
96 | MEMBERSMAP: OFF
97 | - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
98 | VS_VERSION: 16 2019
99 | VS_PLATFORM: x64
100 | CXX11: OFF
101 | CXX17: ON
102 | CXX20: OFF
103 | MEMBERSMAP: ON
104 |
105 | before_build:
106 | - git submodule update --init --recursive
107 | - cmake -H. -BBuild/VS -G "Visual Studio %VS_VERSION%" -DCMAKE_GENERATOR_PLATFORM=%VS_PLATFORM% -DCMAKE_VERBOSE_MAKEFILE=ON -DBUILD_SHARED_LIBS=true -DRAPIDJSON_BUILD_CXX11=%CXX11% -DRAPIDJSON_BUILD_CXX17=%CXX17% -DRAPIDJSON_BUILD_CXX20=%CXX20% -DRAPIDJSON_USE_MEMBERSMAP=%MEMBERSMAP% -Wno-dev
108 |
109 | build:
110 | project: Build\VS\RapidJSON.sln
111 | parallel: true
112 | verbosity: minimal
113 |
114 | test_script:
115 | - cd Build\VS && if %CONFIGURATION%==Debug (ctest --verbose -E perftest --build-config %CONFIGURATION%) else (ctest --verbose --build-config %CONFIGURATION%)
116 |
--------------------------------------------------------------------------------
/bin/data/abcde.txt:
--------------------------------------------------------------------------------
1 | abcde
--------------------------------------------------------------------------------
/bin/data/glossary.json:
--------------------------------------------------------------------------------
1 | {
2 | "glossary": {
3 | "title": "example glossary",
4 | "GlossDiv": {
5 | "title": "S",
6 | "GlossList": {
7 | "GlossEntry": {
8 | "ID": "SGML",
9 | "SortAs": "SGML",
10 | "GlossTerm": "Standard Generalized Markup Language",
11 | "Acronym": "SGML",
12 | "Abbrev": "ISO 8879:1986",
13 | "GlossDef": {
14 | "para": "A meta-markup language, used to create markup languages such as DocBook.",
15 | "GlossSeeAlso": ["GML", "XML"]
16 | },
17 | "GlossSee": "markup"
18 | }
19 | }
20 | }
21 | }
22 | }
--------------------------------------------------------------------------------
/bin/data/menu.json:
--------------------------------------------------------------------------------
1 | {"menu": {
2 | "header": "SVG Viewer",
3 | "items": [
4 | {"id": "Open"},
5 | {"id": "OpenNew", "label": "Open New"},
6 | null,
7 | {"id": "ZoomIn", "label": "Zoom In"},
8 | {"id": "ZoomOut", "label": "Zoom Out"},
9 | {"id": "OriginalView", "label": "Original View"},
10 | null,
11 | {"id": "Quality"},
12 | {"id": "Pause"},
13 | {"id": "Mute"},
14 | null,
15 | {"id": "Find", "label": "Find..."},
16 | {"id": "FindAgain", "label": "Find Again"},
17 | {"id": "Copy"},
18 | {"id": "CopyAgain", "label": "Copy Again"},
19 | {"id": "CopySVG", "label": "Copy SVG"},
20 | {"id": "ViewSVG", "label": "View SVG"},
21 | {"id": "ViewSource", "label": "View Source"},
22 | {"id": "SaveAs", "label": "Save As"},
23 | null,
24 | {"id": "Help"},
25 | {"id": "About", "label": "About Adobe CVG Viewer..."}
26 | ]
27 | }}
--------------------------------------------------------------------------------
/bin/data/readme.txt:
--------------------------------------------------------------------------------
1 | sample.json is obtained from http://code.google.com/p/json-test-suite/downloads/detail?name=sample.zip
2 |
--------------------------------------------------------------------------------
/bin/data/widget.json:
--------------------------------------------------------------------------------
1 | {"widget": {
2 | "debug": "on",
3 | "window": {
4 | "title": "Sample Konfabulator Widget",
5 | "name": "main_window",
6 | "width": 500,
7 | "height": 500
8 | },
9 | "image": {
10 | "src": "Images/Sun.png",
11 | "name": "sun1",
12 | "hOffset": 250,
13 | "vOffset": 250,
14 | "alignment": "center"
15 | },
16 | "text": {
17 | "data": "Click Here",
18 | "size": 36,
19 | "style": "bold",
20 | "name": "text1",
21 | "hOffset": 250,
22 | "vOffset": 100,
23 | "alignment": "center",
24 | "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
25 | }
26 | }}
--------------------------------------------------------------------------------
/bin/encodings/utf16be.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf16be.json
--------------------------------------------------------------------------------
/bin/encodings/utf16bebom.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf16bebom.json
--------------------------------------------------------------------------------
/bin/encodings/utf16le.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf16le.json
--------------------------------------------------------------------------------
/bin/encodings/utf16lebom.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf16lebom.json
--------------------------------------------------------------------------------
/bin/encodings/utf32be.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf32be.json
--------------------------------------------------------------------------------
/bin/encodings/utf32bebom.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf32bebom.json
--------------------------------------------------------------------------------
/bin/encodings/utf32le.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf32le.json
--------------------------------------------------------------------------------
/bin/encodings/utf32lebom.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/bin/encodings/utf32lebom.json
--------------------------------------------------------------------------------
/bin/encodings/utf8.json:
--------------------------------------------------------------------------------
1 | {
2 | "en":"I can eat glass and it doesn't hurt me.",
3 | "zh-Hant":"我能吞下玻璃而不傷身體。",
4 | "zh-Hans":"我能吞下玻璃而不伤身体。",
5 | "ja":"私はガラスを食べられます。それは私を傷つけません。",
6 | "ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"
7 | }
--------------------------------------------------------------------------------
/bin/encodings/utf8bom.json:
--------------------------------------------------------------------------------
1 | {
2 | "en":"I can eat glass and it doesn't hurt me.",
3 | "zh-Hant":"我能吞下玻璃而不傷身體。",
4 | "zh-Hans":"我能吞下玻璃而不伤身体。",
5 | "ja":"私はガラスを食べられます。それは私を傷つけません。",
6 | "ko":"나는 유리를 먹을 수 있어요. 그래도 아프지 않아요"
7 | }
--------------------------------------------------------------------------------
/bin/jsonchecker/fail1.json:
--------------------------------------------------------------------------------
1 | "A JSON payload should be an object or array, not a string."
--------------------------------------------------------------------------------
/bin/jsonchecker/fail10.json:
--------------------------------------------------------------------------------
1 | {"Extra value after close": true} "misplaced quoted value"
--------------------------------------------------------------------------------
/bin/jsonchecker/fail11.json:
--------------------------------------------------------------------------------
1 | {"Illegal expression": 1 + 2}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail12.json:
--------------------------------------------------------------------------------
1 | {"Illegal invocation": alert()}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail13.json:
--------------------------------------------------------------------------------
1 | {"Numbers cannot have leading zeroes": 013}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail14.json:
--------------------------------------------------------------------------------
1 | {"Numbers cannot be hex": 0x14}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail15.json:
--------------------------------------------------------------------------------
1 | ["Illegal backslash escape: \x15"]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail16.json:
--------------------------------------------------------------------------------
1 | [\naked]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail17.json:
--------------------------------------------------------------------------------
1 | ["Illegal backslash escape: \017"]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail18.json:
--------------------------------------------------------------------------------
1 | [[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail19.json:
--------------------------------------------------------------------------------
1 | {"Missing colon" null}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail2.json:
--------------------------------------------------------------------------------
1 | ["Unclosed array"
--------------------------------------------------------------------------------
/bin/jsonchecker/fail20.json:
--------------------------------------------------------------------------------
1 | {"Double colon":: null}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail21.json:
--------------------------------------------------------------------------------
1 | {"Comma instead of colon", null}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail22.json:
--------------------------------------------------------------------------------
1 | ["Colon instead of comma": false]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail23.json:
--------------------------------------------------------------------------------
1 | ["Bad value", truth]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail24.json:
--------------------------------------------------------------------------------
1 | ['single quote']
--------------------------------------------------------------------------------
/bin/jsonchecker/fail25.json:
--------------------------------------------------------------------------------
1 | [" tab character in string "]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail26.json:
--------------------------------------------------------------------------------
1 | ["tab\ character\ in\ string\ "]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail27.json:
--------------------------------------------------------------------------------
1 | ["line
2 | break"]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail28.json:
--------------------------------------------------------------------------------
1 | ["line\
2 | break"]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail29.json:
--------------------------------------------------------------------------------
1 | [0e]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail3.json:
--------------------------------------------------------------------------------
1 | {unquoted_key: "keys must be quoted"}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail30.json:
--------------------------------------------------------------------------------
1 | [0e+]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail31.json:
--------------------------------------------------------------------------------
1 | [0e+-1]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail32.json:
--------------------------------------------------------------------------------
1 | {"Comma instead if closing brace": true,
--------------------------------------------------------------------------------
/bin/jsonchecker/fail33.json:
--------------------------------------------------------------------------------
1 | ["mismatch"}
--------------------------------------------------------------------------------
/bin/jsonchecker/fail4.json:
--------------------------------------------------------------------------------
1 | ["extra comma",]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail5.json:
--------------------------------------------------------------------------------
1 | ["double extra comma",,]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail6.json:
--------------------------------------------------------------------------------
1 | [ , "<-- missing value"]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail7.json:
--------------------------------------------------------------------------------
1 | ["Comma after the close"],
--------------------------------------------------------------------------------
/bin/jsonchecker/fail8.json:
--------------------------------------------------------------------------------
1 | ["Extra close"]]
--------------------------------------------------------------------------------
/bin/jsonchecker/fail9.json:
--------------------------------------------------------------------------------
1 | {"Extra comma": true,}
--------------------------------------------------------------------------------
/bin/jsonchecker/pass1.json:
--------------------------------------------------------------------------------
1 | [
2 | "JSON Test Pattern pass1",
3 | {"object with 1 member":["array with 1 element"]},
4 | {},
5 | [],
6 | -42,
7 | true,
8 | false,
9 | null,
10 | {
11 | "integer": 1234567890,
12 | "real": -9876.543210,
13 | "e": 0.123456789e-12,
14 | "E": 1.234567890E+34,
15 | "": 23456789012E66,
16 | "zero": 0,
17 | "one": 1,
18 | "space": " ",
19 | "quote": "\"",
20 | "backslash": "\\",
21 | "controls": "\b\f\n\r\t",
22 | "slash": "/ & \/",
23 | "alpha": "abcdefghijklmnopqrstuvwyz",
24 | "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ",
25 | "digit": "0123456789",
26 | "0123456789": "digit",
27 | "special": "`1~!@#$%^&*()_+-={':[,]}|;.>?",
28 | "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A",
29 | "true": true,
30 | "false": false,
31 | "null": null,
32 | "array":[ ],
33 | "object":{ },
34 | "address": "50 St. James Street",
35 | "url": "http://www.JSON.org/",
36 | "comment": "// /* */": " ",
38 | " s p a c e d " :[1,2 , 3
39 |
40 | ,
41 |
42 | 4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7],
43 | "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}",
44 | "quotes": "" \u0022 %22 0x22 034 "",
45 | "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?"
46 | : "A key can be any string"
47 | },
48 | 0.5 ,98.6
49 | ,
50 | 99.44
51 | ,
52 |
53 | 1066,
54 | 1e1,
55 | 0.1e1,
56 | 1e-1,
57 | 1e00,2e+00,2e-00
58 | ,"rosebud"]
--------------------------------------------------------------------------------
/bin/jsonchecker/pass2.json:
--------------------------------------------------------------------------------
1 | [[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]]
--------------------------------------------------------------------------------
/bin/jsonchecker/pass3.json:
--------------------------------------------------------------------------------
1 | {
2 | "JSON Test Pattern pass3": {
3 | "The outermost value": "must be an object or array.",
4 | "In this test": "It is an object."
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/bin/jsonchecker/readme.txt:
--------------------------------------------------------------------------------
1 | Test suite from http://json.org/JSON_checker/.
2 |
3 | If the JSON_checker is working correctly, it must accept all of the pass*.json files and reject all of the fail*.json files.
4 |
--------------------------------------------------------------------------------
/bin/jsonschema/.gitignore:
--------------------------------------------------------------------------------
1 | TODO
2 |
--------------------------------------------------------------------------------
/bin/jsonschema/.travis.yml:
--------------------------------------------------------------------------------
1 | language: python
2 | python: "2.7"
3 | install: pip install jsonschema
4 | script: bin/jsonschema_suite check
5 |
--------------------------------------------------------------------------------
/bin/jsonschema/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012 Julian Berman
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/bin/jsonschema/remotes/folder/folderInteger.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "integer"
3 | }
--------------------------------------------------------------------------------
/bin/jsonschema/remotes/integer.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "integer"
3 | }
--------------------------------------------------------------------------------
/bin/jsonschema/remotes/subSchemas.json:
--------------------------------------------------------------------------------
1 | {
2 | "integer": {
3 | "type": "integer"
4 | },
5 | "refToInteger": {
6 | "$ref": "#/integer"
7 | }
8 | }
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/additionalItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "additionalItems as schema",
4 | "schema": {
5 | "items": [],
6 | "additionalItems": {"type": "integer"}
7 | },
8 | "tests": [
9 | {
10 | "description": "additional items match schema",
11 | "data": [ 1, 2, 3, 4 ],
12 | "valid": true
13 | },
14 | {
15 | "description": "additional items do not match schema",
16 | "data": [ 1, 2, 3, "foo" ],
17 | "valid": false
18 | }
19 | ]
20 | },
21 | {
22 | "description": "items is schema, no additionalItems",
23 | "schema": {
24 | "items": {},
25 | "additionalItems": false
26 | },
27 | "tests": [
28 | {
29 | "description": "all items match schema",
30 | "data": [ 1, 2, 3, 4, 5 ],
31 | "valid": true
32 | }
33 | ]
34 | },
35 | {
36 | "description": "array of items with no additionalItems",
37 | "schema": {
38 | "items": [{}, {}, {}],
39 | "additionalItems": false
40 | },
41 | "tests": [
42 | {
43 | "description": "no additional items present",
44 | "data": [ 1, 2, 3 ],
45 | "valid": true
46 | },
47 | {
48 | "description": "additional items are not permitted",
49 | "data": [ 1, 2, 3, 4 ],
50 | "valid": false
51 | }
52 | ]
53 | },
54 | {
55 | "description": "additionalItems as false without items",
56 | "schema": {"additionalItems": false},
57 | "tests": [
58 | {
59 | "description":
60 | "items defaults to empty schema so everything is valid",
61 | "data": [ 1, 2, 3, 4, 5 ],
62 | "valid": true
63 | },
64 | {
65 | "description": "ignores non-arrays",
66 | "data": {"foo" : "bar"},
67 | "valid": true
68 | }
69 | ]
70 | },
71 | {
72 | "description": "additionalItems are allowed by default",
73 | "schema": {"items": []},
74 | "tests": [
75 | {
76 | "description": "only the first items are validated",
77 | "data": [1, "foo", false],
78 | "valid": true
79 | }
80 | ]
81 | }
82 | ]
83 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/additionalProperties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description":
4 | "additionalProperties being false does not allow other properties",
5 | "schema": {
6 | "properties": {"foo": {}, "bar": {}},
7 | "patternProperties": { "^v": {} },
8 | "additionalProperties": false
9 | },
10 | "tests": [
11 | {
12 | "description": "no additional properties is valid",
13 | "data": {"foo": 1},
14 | "valid": true
15 | },
16 | {
17 | "description": "an additional property is invalid",
18 | "data": {"foo" : 1, "bar" : 2, "quux" : "boom"},
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-objects",
23 | "data": [1, 2, 3],
24 | "valid": true
25 | },
26 | {
27 | "description": "patternProperties are not additional properties",
28 | "data": {"foo":1, "vroom": 2},
29 | "valid": true
30 | }
31 | ]
32 | },
33 | {
34 | "description":
35 | "additionalProperties allows a schema which should validate",
36 | "schema": {
37 | "properties": {"foo": {}, "bar": {}},
38 | "additionalProperties": {"type": "boolean"}
39 | },
40 | "tests": [
41 | {
42 | "description": "no additional properties is valid",
43 | "data": {"foo": 1},
44 | "valid": true
45 | },
46 | {
47 | "description": "an additional valid property is valid",
48 | "data": {"foo" : 1, "bar" : 2, "quux" : true},
49 | "valid": true
50 | },
51 | {
52 | "description": "an additional invalid property is invalid",
53 | "data": {"foo" : 1, "bar" : 2, "quux" : 12},
54 | "valid": false
55 | }
56 | ]
57 | },
58 | {
59 | "description":
60 | "additionalProperties can exist by itself",
61 | "schema": {
62 | "additionalProperties": {"type": "boolean"}
63 | },
64 | "tests": [
65 | {
66 | "description": "an additional valid property is valid",
67 | "data": {"foo" : true},
68 | "valid": true
69 | },
70 | {
71 | "description": "an additional invalid property is invalid",
72 | "data": {"foo" : 1},
73 | "valid": false
74 | }
75 | ]
76 | },
77 | {
78 | "description": "additionalProperties are allowed by default",
79 | "schema": {"properties": {"foo": {}, "bar": {}}},
80 | "tests": [
81 | {
82 | "description": "additional properties are allowed",
83 | "data": {"foo": 1, "bar": 2, "quux": true},
84 | "valid": true
85 | }
86 | ]
87 | }
88 | ]
89 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/default.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "invalid type for default",
4 | "schema": {
5 | "properties": {
6 | "foo": {
7 | "type": "integer",
8 | "default": []
9 | }
10 | }
11 | },
12 | "tests": [
13 | {
14 | "description": "valid when property is specified",
15 | "data": {"foo": 13},
16 | "valid": true
17 | },
18 | {
19 | "description": "still valid when the invalid default is used",
20 | "data": {},
21 | "valid": true
22 | }
23 | ]
24 | },
25 | {
26 | "description": "invalid string value for default",
27 | "schema": {
28 | "properties": {
29 | "bar": {
30 | "type": "string",
31 | "minLength": 4,
32 | "default": "bad"
33 | }
34 | }
35 | },
36 | "tests": [
37 | {
38 | "description": "valid when property is specified",
39 | "data": {"bar": "good"},
40 | "valid": true
41 | },
42 | {
43 | "description": "still valid when the invalid default is used",
44 | "data": {},
45 | "valid": true
46 | }
47 | ]
48 | }
49 | ]
50 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/dependencies.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "dependencies",
4 | "schema": {
5 | "dependencies": {"bar": "foo"}
6 | },
7 | "tests": [
8 | {
9 | "description": "neither",
10 | "data": {},
11 | "valid": true
12 | },
13 | {
14 | "description": "nondependant",
15 | "data": {"foo": 1},
16 | "valid": true
17 | },
18 | {
19 | "description": "with dependency",
20 | "data": {"foo": 1, "bar": 2},
21 | "valid": true
22 | },
23 | {
24 | "description": "missing dependency",
25 | "data": {"bar": 2},
26 | "valid": false
27 | },
28 | {
29 | "description": "ignores non-objects",
30 | "data": "foo",
31 | "valid": true
32 | }
33 | ]
34 | },
35 | {
36 | "description": "multiple dependencies",
37 | "schema": {
38 | "dependencies": {"quux": ["foo", "bar"]}
39 | },
40 | "tests": [
41 | {
42 | "description": "neither",
43 | "data": {},
44 | "valid": true
45 | },
46 | {
47 | "description": "nondependants",
48 | "data": {"foo": 1, "bar": 2},
49 | "valid": true
50 | },
51 | {
52 | "description": "with dependencies",
53 | "data": {"foo": 1, "bar": 2, "quux": 3},
54 | "valid": true
55 | },
56 | {
57 | "description": "missing dependency",
58 | "data": {"foo": 1, "quux": 2},
59 | "valid": false
60 | },
61 | {
62 | "description": "missing other dependency",
63 | "data": {"bar": 1, "quux": 2},
64 | "valid": false
65 | },
66 | {
67 | "description": "missing both dependencies",
68 | "data": {"quux": 1},
69 | "valid": false
70 | }
71 | ]
72 | },
73 | {
74 | "description": "multiple dependencies subschema",
75 | "schema": {
76 | "dependencies": {
77 | "bar": {
78 | "properties": {
79 | "foo": {"type": "integer"},
80 | "bar": {"type": "integer"}
81 | }
82 | }
83 | }
84 | },
85 | "tests": [
86 | {
87 | "description": "valid",
88 | "data": {"foo": 1, "bar": 2},
89 | "valid": true
90 | },
91 | {
92 | "description": "wrong type",
93 | "data": {"foo": "quux", "bar": 2},
94 | "valid": false
95 | },
96 | {
97 | "description": "wrong type other",
98 | "data": {"foo": 2, "bar": "quux"},
99 | "valid": false
100 | },
101 | {
102 | "description": "wrong type both",
103 | "data": {"foo": "quux", "bar": "quux"},
104 | "valid": false
105 | }
106 | ]
107 | }
108 | ]
109 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/disallow.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "disallow",
4 | "schema": {
5 | "disallow": "integer"
6 | },
7 | "tests": [
8 | {
9 | "description": "allowed",
10 | "data": "foo",
11 | "valid": true
12 | },
13 | {
14 | "description": "disallowed",
15 | "data": 1,
16 | "valid": false
17 | }
18 | ]
19 | },
20 | {
21 | "description": "multiple disallow",
22 | "schema": {
23 | "disallow": ["integer", "boolean"]
24 | },
25 | "tests": [
26 | {
27 | "description": "valid",
28 | "data": "foo",
29 | "valid": true
30 | },
31 | {
32 | "description": "mismatch",
33 | "data": 1,
34 | "valid": false
35 | },
36 | {
37 | "description": "other mismatch",
38 | "data": true,
39 | "valid": false
40 | }
41 | ]
42 | },
43 | {
44 | "description": "multiple disallow subschema",
45 | "schema": {
46 | "disallow":
47 | ["string",
48 | {
49 | "type": "object",
50 | "properties": {
51 | "foo": {
52 | "type": "string"
53 | }
54 | }
55 | }]
56 | },
57 | "tests": [
58 | {
59 | "description": "match",
60 | "data": 1,
61 | "valid": true
62 | },
63 | {
64 | "description": "other match",
65 | "data": {"foo": 1},
66 | "valid": true
67 | },
68 | {
69 | "description": "mismatch",
70 | "data": "foo",
71 | "valid": false
72 | },
73 | {
74 | "description": "other mismatch",
75 | "data": {"foo": "bar"},
76 | "valid": false
77 | }
78 | ]
79 | }
80 | ]
81 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/divisibleBy.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "by int",
4 | "schema": {"divisibleBy": 2},
5 | "tests": [
6 | {
7 | "description": "int by int",
8 | "data": 10,
9 | "valid": true
10 | },
11 | {
12 | "description": "int by int fail",
13 | "data": 7,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "foo",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "by number",
25 | "schema": {"divisibleBy": 1.5},
26 | "tests": [
27 | {
28 | "description": "zero is divisible by anything (except 0)",
29 | "data": 0,
30 | "valid": true
31 | },
32 | {
33 | "description": "4.5 is divisible by 1.5",
34 | "data": 4.5,
35 | "valid": true
36 | },
37 | {
38 | "description": "35 is not divisible by 1.5",
39 | "data": 35,
40 | "valid": false
41 | }
42 | ]
43 | },
44 | {
45 | "description": "by small number",
46 | "schema": {"divisibleBy": 0.0001},
47 | "tests": [
48 | {
49 | "description": "0.0075 is divisible by 0.0001",
50 | "data": 0.0075,
51 | "valid": true
52 | },
53 | {
54 | "description": "0.00751 is not divisible by 0.0001",
55 | "data": 0.00751,
56 | "valid": false
57 | }
58 | ]
59 | }
60 | ]
61 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/enum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "simple enum validation",
4 | "schema": {"enum": [1, 2, 3]},
5 | "tests": [
6 | {
7 | "description": "one of the enum is valid",
8 | "data": 1,
9 | "valid": true
10 | },
11 | {
12 | "description": "something else is invalid",
13 | "data": 4,
14 | "valid": false
15 | }
16 | ]
17 | },
18 | {
19 | "description": "heterogeneous enum validation",
20 | "schema": {"enum": [6, "foo", [], true, {"foo": 12}]},
21 | "tests": [
22 | {
23 | "description": "one of the enum is valid",
24 | "data": [],
25 | "valid": true
26 | },
27 | {
28 | "description": "something else is invalid",
29 | "data": null,
30 | "valid": false
31 | },
32 | {
33 | "description": "objects are deep compared",
34 | "data": {"foo": false},
35 | "valid": false
36 | }
37 | ]
38 | },
39 | {
40 | "description": "enums in properties",
41 | "schema": {
42 | "type":"object",
43 | "properties": {
44 | "foo": {"enum":["foo"]},
45 | "bar": {"enum":["bar"], "required":true}
46 | }
47 | },
48 | "tests": [
49 | {
50 | "description": "both properties are valid",
51 | "data": {"foo":"foo", "bar":"bar"},
52 | "valid": true
53 | },
54 | {
55 | "description": "missing optional property is valid",
56 | "data": {"bar":"bar"},
57 | "valid": true
58 | },
59 | {
60 | "description": "missing required property is invalid",
61 | "data": {"foo":"foo"},
62 | "valid": false
63 | },
64 | {
65 | "description": "missing all properties is invalid",
66 | "data": {},
67 | "valid": false
68 | }
69 | ]
70 | }
71 | ]
72 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/extends.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "extends",
4 | "schema": {
5 | "properties": {"bar": {"type": "integer", "required": true}},
6 | "extends": {
7 | "properties": {
8 | "foo": {"type": "string", "required": true}
9 | }
10 | }
11 | },
12 | "tests": [
13 | {
14 | "description": "extends",
15 | "data": {"foo": "baz", "bar": 2},
16 | "valid": true
17 | },
18 | {
19 | "description": "mismatch extends",
20 | "data": {"foo": "baz"},
21 | "valid": false
22 | },
23 | {
24 | "description": "mismatch extended",
25 | "data": {"bar": 2},
26 | "valid": false
27 | },
28 | {
29 | "description": "wrong type",
30 | "data": {"foo": "baz", "bar": "quux"},
31 | "valid": false
32 | }
33 | ]
34 | },
35 | {
36 | "description": "multiple extends",
37 | "schema": {
38 | "properties": {"bar": {"type": "integer", "required": true}},
39 | "extends" : [
40 | {
41 | "properties": {
42 | "foo": {"type": "string", "required": true}
43 | }
44 | },
45 | {
46 | "properties": {
47 | "baz": {"type": "null", "required": true}
48 | }
49 | }
50 | ]
51 | },
52 | "tests": [
53 | {
54 | "description": "valid",
55 | "data": {"foo": "quux", "bar": 2, "baz": null},
56 | "valid": true
57 | },
58 | {
59 | "description": "mismatch first extends",
60 | "data": {"bar": 2, "baz": null},
61 | "valid": false
62 | },
63 | {
64 | "description": "mismatch second extends",
65 | "data": {"foo": "quux", "bar": 2},
66 | "valid": false
67 | },
68 | {
69 | "description": "mismatch both",
70 | "data": {"bar": 2},
71 | "valid": false
72 | }
73 | ]
74 | },
75 | {
76 | "description": "extends simple types",
77 | "schema": {
78 | "minimum": 20,
79 | "extends": {"maximum": 30}
80 | },
81 | "tests": [
82 | {
83 | "description": "valid",
84 | "data": 25,
85 | "valid": true
86 | },
87 | {
88 | "description": "mismatch extends",
89 | "data": 35,
90 | "valid": false
91 | }
92 | ]
93 | }
94 | ]
95 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/items.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "a schema given for items",
4 | "schema": {
5 | "items": {"type": "integer"}
6 | },
7 | "tests": [
8 | {
9 | "description": "valid items",
10 | "data": [ 1, 2, 3 ],
11 | "valid": true
12 | },
13 | {
14 | "description": "wrong type of items",
15 | "data": [1, "x"],
16 | "valid": false
17 | },
18 | {
19 | "description": "ignores non-arrays",
20 | "data": {"foo" : "bar"},
21 | "valid": true
22 | }
23 | ]
24 | },
25 | {
26 | "description": "an array of schemas for items",
27 | "schema": {
28 | "items": [
29 | {"type": "integer"},
30 | {"type": "string"}
31 | ]
32 | },
33 | "tests": [
34 | {
35 | "description": "correct types",
36 | "data": [ 1, "foo" ],
37 | "valid": true
38 | },
39 | {
40 | "description": "wrong types",
41 | "data": [ "foo", 1 ],
42 | "valid": false
43 | }
44 | ]
45 | }
46 | ]
47 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/maxItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxItems validation",
4 | "schema": {"maxItems": 2},
5 | "tests": [
6 | {
7 | "description": "shorter is valid",
8 | "data": [1],
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": [1, 2],
14 | "valid": true
15 | },
16 | {
17 | "description": "too long is invalid",
18 | "data": [1, 2, 3],
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-arrays",
23 | "data": "foobar",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/maxLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxLength validation",
4 | "schema": {"maxLength": 2},
5 | "tests": [
6 | {
7 | "description": "shorter is valid",
8 | "data": "f",
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": "fo",
14 | "valid": true
15 | },
16 | {
17 | "description": "too long is invalid",
18 | "data": "foo",
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-strings",
23 | "data": 10,
24 | "valid": true
25 | },
26 | {
27 | "description": "two supplementary Unicode code points is long enough",
28 | "data": "\uD83D\uDCA9\uD83D\uDCA9",
29 | "valid": true
30 | }
31 | ]
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/maximum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maximum validation",
4 | "schema": {"maximum": 3.0},
5 | "tests": [
6 | {
7 | "description": "below the maximum is valid",
8 | "data": 2.6,
9 | "valid": true
10 | },
11 | {
12 | "description": "above the maximum is invalid",
13 | "data": 3.5,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "x",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "exclusiveMaximum validation",
25 | "schema": {
26 | "maximum": 3.0,
27 | "exclusiveMaximum": true
28 | },
29 | "tests": [
30 | {
31 | "description": "below the maximum is still valid",
32 | "data": 2.2,
33 | "valid": true
34 | },
35 | {
36 | "description": "boundary point is invalid",
37 | "data": 3.0,
38 | "valid": false
39 | }
40 | ]
41 | }
42 | ]
43 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/minItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minItems validation",
4 | "schema": {"minItems": 1},
5 | "tests": [
6 | {
7 | "description": "longer is valid",
8 | "data": [1, 2],
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": [1],
14 | "valid": true
15 | },
16 | {
17 | "description": "too short is invalid",
18 | "data": [],
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-arrays",
23 | "data": "",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/minLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minLength validation",
4 | "schema": {"minLength": 2},
5 | "tests": [
6 | {
7 | "description": "longer is valid",
8 | "data": "foo",
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": "fo",
14 | "valid": true
15 | },
16 | {
17 | "description": "too short is invalid",
18 | "data": "f",
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-strings",
23 | "data": 1,
24 | "valid": true
25 | },
26 | {
27 | "description": "one supplementary Unicode code point is not long enough",
28 | "data": "\uD83D\uDCA9",
29 | "valid": false
30 | }
31 | ]
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/minimum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minimum validation",
4 | "schema": {"minimum": 1.1},
5 | "tests": [
6 | {
7 | "description": "above the minimum is valid",
8 | "data": 2.6,
9 | "valid": true
10 | },
11 | {
12 | "description": "below the minimum is invalid",
13 | "data": 0.6,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "x",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "exclusiveMinimum validation",
25 | "schema": {
26 | "minimum": 1.1,
27 | "exclusiveMinimum": true
28 | },
29 | "tests": [
30 | {
31 | "description": "above the minimum is still valid",
32 | "data": 1.2,
33 | "valid": true
34 | },
35 | {
36 | "description": "boundary point is invalid",
37 | "data": 1.1,
38 | "valid": false
39 | }
40 | ]
41 | }
42 | ]
43 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/optional/jsregex.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "ECMA 262 regex dialect recognition",
4 | "schema": { "format": "regex" },
5 | "tests": [
6 | {
7 | "description": "[^] is a valid regex",
8 | "data": "[^]",
9 | "valid": true
10 | },
11 | {
12 | "description": "ECMA 262 has no support for lookbehind",
13 | "data": "(?<=foo)bar",
14 | "valid": false
15 | }
16 | ]
17 | }
18 | ]
19 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/optional/zeroTerminatedFloats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "some languages do not distinguish between different types of numeric value",
4 | "schema": {
5 | "type": "integer"
6 | },
7 | "tests": [
8 | {
9 | "description": "a float is not an integer even without fractional part",
10 | "data": 1.0,
11 | "valid": false
12 | }
13 | ]
14 | }
15 | ]
16 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/pattern.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "pattern validation",
4 | "schema": {"pattern": "^a*$"},
5 | "tests": [
6 | {
7 | "description": "a matching pattern is valid",
8 | "data": "aaa",
9 | "valid": true
10 | },
11 | {
12 | "description": "a non-matching pattern is invalid",
13 | "data": "abc",
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-strings",
18 | "data": true,
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "pattern is not anchored",
25 | "schema": {"pattern": "a+"},
26 | "tests": [
27 | {
28 | "description": "matches a substring",
29 | "data": "xxaayy",
30 | "valid": true
31 | }
32 | ]
33 | }
34 | ]
35 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/properties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "object properties validation",
4 | "schema": {
5 | "properties": {
6 | "foo": {"type": "integer"},
7 | "bar": {"type": "string"}
8 | }
9 | },
10 | "tests": [
11 | {
12 | "description": "both properties present and valid is valid",
13 | "data": {"foo": 1, "bar": "baz"},
14 | "valid": true
15 | },
16 | {
17 | "description": "one property invalid is invalid",
18 | "data": {"foo": 1, "bar": {}},
19 | "valid": false
20 | },
21 | {
22 | "description": "both properties invalid is invalid",
23 | "data": {"foo": [], "bar": {}},
24 | "valid": false
25 | },
26 | {
27 | "description": "doesn't invalidate other properties",
28 | "data": {"quux": []},
29 | "valid": true
30 | },
31 | {
32 | "description": "ignores non-objects",
33 | "data": [],
34 | "valid": true
35 | }
36 | ]
37 | },
38 | {
39 | "description":
40 | "properties, patternProperties, additionalProperties interaction",
41 | "schema": {
42 | "properties": {
43 | "foo": {"type": "array", "maxItems": 3},
44 | "bar": {"type": "array"}
45 | },
46 | "patternProperties": {"f.o": {"minItems": 2}},
47 | "additionalProperties": {"type": "integer"}
48 | },
49 | "tests": [
50 | {
51 | "description": "property validates property",
52 | "data": {"foo": [1, 2]},
53 | "valid": true
54 | },
55 | {
56 | "description": "property invalidates property",
57 | "data": {"foo": [1, 2, 3, 4]},
58 | "valid": false
59 | },
60 | {
61 | "description": "patternProperty invalidates property",
62 | "data": {"foo": []},
63 | "valid": false
64 | },
65 | {
66 | "description": "patternProperty validates nonproperty",
67 | "data": {"fxo": [1, 2]},
68 | "valid": true
69 | },
70 | {
71 | "description": "patternProperty invalidates nonproperty",
72 | "data": {"fxo": []},
73 | "valid": false
74 | },
75 | {
76 | "description": "additionalProperty ignores property",
77 | "data": {"bar": []},
78 | "valid": true
79 | },
80 | {
81 | "description": "additionalProperty validates others",
82 | "data": {"quux": 3},
83 | "valid": true
84 | },
85 | {
86 | "description": "additionalProperty invalidates others",
87 | "data": {"quux": "foo"},
88 | "valid": false
89 | }
90 | ]
91 | }
92 | ]
93 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/refRemote.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "remote ref",
4 | "schema": {"$ref": "http://localhost:1234/integer.json"},
5 | "tests": [
6 | {
7 | "description": "remote ref valid",
8 | "data": 1,
9 | "valid": true
10 | },
11 | {
12 | "description": "remote ref invalid",
13 | "data": "a",
14 | "valid": false
15 | }
16 | ]
17 | },
18 | {
19 | "description": "fragment within remote ref",
20 | "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"},
21 | "tests": [
22 | {
23 | "description": "remote fragment valid",
24 | "data": 1,
25 | "valid": true
26 | },
27 | {
28 | "description": "remote fragment invalid",
29 | "data": "a",
30 | "valid": false
31 | }
32 | ]
33 | },
34 | {
35 | "description": "ref within remote ref",
36 | "schema": {
37 | "$ref": "http://localhost:1234/subSchemas.json#/refToInteger"
38 | },
39 | "tests": [
40 | {
41 | "description": "ref within ref valid",
42 | "data": 1,
43 | "valid": true
44 | },
45 | {
46 | "description": "ref within ref invalid",
47 | "data": "a",
48 | "valid": false
49 | }
50 | ]
51 | },
52 | {
53 | "description": "change resolution scope",
54 | "schema": {
55 | "id": "http://localhost:1234/",
56 | "items": {
57 | "id": "folder/",
58 | "items": {"$ref": "folderInteger.json"}
59 | }
60 | },
61 | "tests": [
62 | {
63 | "description": "changed scope ref valid",
64 | "data": [[1]],
65 | "valid": true
66 | },
67 | {
68 | "description": "changed scope ref invalid",
69 | "data": [["a"]],
70 | "valid": false
71 | }
72 | ]
73 | }
74 | ]
75 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/required.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "required validation",
4 | "schema": {
5 | "properties": {
6 | "foo": {"required" : true},
7 | "bar": {}
8 | }
9 | },
10 | "tests": [
11 | {
12 | "description": "present required property is valid",
13 | "data": {"foo": 1},
14 | "valid": true
15 | },
16 | {
17 | "description": "non-present required property is invalid",
18 | "data": {"bar": 1},
19 | "valid": false
20 | }
21 | ]
22 | },
23 | {
24 | "description": "required default validation",
25 | "schema": {
26 | "properties": {
27 | "foo": {}
28 | }
29 | },
30 | "tests": [
31 | {
32 | "description": "not required by default",
33 | "data": {},
34 | "valid": true
35 | }
36 | ]
37 | },
38 | {
39 | "description": "required explicitly false validation",
40 | "schema": {
41 | "properties": {
42 | "foo": {"required": false}
43 | }
44 | },
45 | "tests": [
46 | {
47 | "description": "not required if required is false",
48 | "data": {},
49 | "valid": true
50 | }
51 | ]
52 | }
53 | ]
54 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft3/uniqueItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "uniqueItems validation",
4 | "schema": {"uniqueItems": true},
5 | "tests": [
6 | {
7 | "description": "unique array of integers is valid",
8 | "data": [1, 2],
9 | "valid": true
10 | },
11 | {
12 | "description": "non-unique array of integers is invalid",
13 | "data": [1, 1],
14 | "valid": false
15 | },
16 | {
17 | "description": "numbers are unique if mathematically unequal",
18 | "data": [1.0, 1.00, 1],
19 | "valid": false
20 | },
21 | {
22 | "description": "unique array of objects is valid",
23 | "data": [{"foo": "bar"}, {"foo": "baz"}],
24 | "valid": true
25 | },
26 | {
27 | "description": "non-unique array of objects is invalid",
28 | "data": [{"foo": "bar"}, {"foo": "bar"}],
29 | "valid": false
30 | },
31 | {
32 | "description": "unique array of nested objects is valid",
33 | "data": [
34 | {"foo": {"bar" : {"baz" : true}}},
35 | {"foo": {"bar" : {"baz" : false}}}
36 | ],
37 | "valid": true
38 | },
39 | {
40 | "description": "non-unique array of nested objects is invalid",
41 | "data": [
42 | {"foo": {"bar" : {"baz" : true}}},
43 | {"foo": {"bar" : {"baz" : true}}}
44 | ],
45 | "valid": false
46 | },
47 | {
48 | "description": "unique array of arrays is valid",
49 | "data": [["foo"], ["bar"]],
50 | "valid": true
51 | },
52 | {
53 | "description": "non-unique array of arrays is invalid",
54 | "data": [["foo"], ["foo"]],
55 | "valid": false
56 | },
57 | {
58 | "description": "1 and true are unique",
59 | "data": [1, true],
60 | "valid": true
61 | },
62 | {
63 | "description": "0 and false are unique",
64 | "data": [0, false],
65 | "valid": true
66 | },
67 | {
68 | "description": "unique heterogeneous types are valid",
69 | "data": [{}, [1], true, null, 1],
70 | "valid": true
71 | },
72 | {
73 | "description": "non-unique heterogeneous types are invalid",
74 | "data": [{}, [1], true, null, {}, 1],
75 | "valid": false
76 | }
77 | ]
78 | }
79 | ]
80 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/additionalItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "additionalItems as schema",
4 | "schema": {
5 | "items": [{}],
6 | "additionalItems": {"type": "integer"}
7 | },
8 | "tests": [
9 | {
10 | "description": "additional items match schema",
11 | "data": [ null, 2, 3, 4 ],
12 | "valid": true
13 | },
14 | {
15 | "description": "additional items do not match schema",
16 | "data": [ null, 2, 3, "foo" ],
17 | "valid": false
18 | }
19 | ]
20 | },
21 | {
22 | "description": "items is schema, no additionalItems",
23 | "schema": {
24 | "items": {},
25 | "additionalItems": false
26 | },
27 | "tests": [
28 | {
29 | "description": "all items match schema",
30 | "data": [ 1, 2, 3, 4, 5 ],
31 | "valid": true
32 | }
33 | ]
34 | },
35 | {
36 | "description": "array of items with no additionalItems",
37 | "schema": {
38 | "items": [{}, {}, {}],
39 | "additionalItems": false
40 | },
41 | "tests": [
42 | {
43 | "description": "no additional items present",
44 | "data": [ 1, 2, 3 ],
45 | "valid": true
46 | },
47 | {
48 | "description": "additional items are not permitted",
49 | "data": [ 1, 2, 3, 4 ],
50 | "valid": false
51 | }
52 | ]
53 | },
54 | {
55 | "description": "additionalItems as false without items",
56 | "schema": {"additionalItems": false},
57 | "tests": [
58 | {
59 | "description":
60 | "items defaults to empty schema so everything is valid",
61 | "data": [ 1, 2, 3, 4, 5 ],
62 | "valid": true
63 | },
64 | {
65 | "description": "ignores non-arrays",
66 | "data": {"foo" : "bar"},
67 | "valid": true
68 | }
69 | ]
70 | },
71 | {
72 | "description": "additionalItems are allowed by default",
73 | "schema": {"items": [{"type": "integer"}]},
74 | "tests": [
75 | {
76 | "description": "only the first item is validated",
77 | "data": [1, "foo", false],
78 | "valid": true
79 | }
80 | ]
81 | }
82 | ]
83 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/additionalProperties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description":
4 | "additionalProperties being false does not allow other properties",
5 | "schema": {
6 | "properties": {"foo": {}, "bar": {}},
7 | "patternProperties": { "^v": {} },
8 | "additionalProperties": false
9 | },
10 | "tests": [
11 | {
12 | "description": "no additional properties is valid",
13 | "data": {"foo": 1},
14 | "valid": true
15 | },
16 | {
17 | "description": "an additional property is invalid",
18 | "data": {"foo" : 1, "bar" : 2, "quux" : "boom"},
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-objects",
23 | "data": [1, 2, 3],
24 | "valid": true
25 | },
26 | {
27 | "description": "patternProperties are not additional properties",
28 | "data": {"foo":1, "vroom": 2},
29 | "valid": true
30 | }
31 | ]
32 | },
33 | {
34 | "description":
35 | "additionalProperties allows a schema which should validate",
36 | "schema": {
37 | "properties": {"foo": {}, "bar": {}},
38 | "additionalProperties": {"type": "boolean"}
39 | },
40 | "tests": [
41 | {
42 | "description": "no additional properties is valid",
43 | "data": {"foo": 1},
44 | "valid": true
45 | },
46 | {
47 | "description": "an additional valid property is valid",
48 | "data": {"foo" : 1, "bar" : 2, "quux" : true},
49 | "valid": true
50 | },
51 | {
52 | "description": "an additional invalid property is invalid",
53 | "data": {"foo" : 1, "bar" : 2, "quux" : 12},
54 | "valid": false
55 | }
56 | ]
57 | },
58 | {
59 | "description":
60 | "additionalProperties can exist by itself",
61 | "schema": {
62 | "additionalProperties": {"type": "boolean"}
63 | },
64 | "tests": [
65 | {
66 | "description": "an additional valid property is valid",
67 | "data": {"foo" : true},
68 | "valid": true
69 | },
70 | {
71 | "description": "an additional invalid property is invalid",
72 | "data": {"foo" : 1},
73 | "valid": false
74 | }
75 | ]
76 | },
77 | {
78 | "description": "additionalProperties are allowed by default",
79 | "schema": {"properties": {"foo": {}, "bar": {}}},
80 | "tests": [
81 | {
82 | "description": "additional properties are allowed",
83 | "data": {"foo": 1, "bar": 2, "quux": true},
84 | "valid": true
85 | }
86 | ]
87 | }
88 | ]
89 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/anyOf.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "anyOf",
4 | "schema": {
5 | "anyOf": [
6 | {
7 | "type": "integer"
8 | },
9 | {
10 | "minimum": 2
11 | }
12 | ]
13 | },
14 | "tests": [
15 | {
16 | "description": "first anyOf valid",
17 | "data": 1,
18 | "valid": true
19 | },
20 | {
21 | "description": "second anyOf valid",
22 | "data": 2.5,
23 | "valid": true
24 | },
25 | {
26 | "description": "both anyOf valid",
27 | "data": 3,
28 | "valid": true
29 | },
30 | {
31 | "description": "neither anyOf valid",
32 | "data": 1.5,
33 | "valid": false
34 | }
35 | ]
36 | },
37 | {
38 | "description": "anyOf with base schema",
39 | "schema": {
40 | "type": "string",
41 | "anyOf" : [
42 | {
43 | "maxLength": 2
44 | },
45 | {
46 | "minLength": 4
47 | }
48 | ]
49 | },
50 | "tests": [
51 | {
52 | "description": "mismatch base schema",
53 | "data": 3,
54 | "valid": false
55 | },
56 | {
57 | "description": "one anyOf valid",
58 | "data": "foobar",
59 | "valid": true
60 | },
61 | {
62 | "description": "both anyOf invalid",
63 | "data": "foo",
64 | "valid": false
65 | }
66 | ]
67 | }
68 | ]
69 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/default.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "invalid type for default",
4 | "schema": {
5 | "properties": {
6 | "foo": {
7 | "type": "integer",
8 | "default": []
9 | }
10 | }
11 | },
12 | "tests": [
13 | {
14 | "description": "valid when property is specified",
15 | "data": {"foo": 13},
16 | "valid": true
17 | },
18 | {
19 | "description": "still valid when the invalid default is used",
20 | "data": {},
21 | "valid": true
22 | }
23 | ]
24 | },
25 | {
26 | "description": "invalid string value for default",
27 | "schema": {
28 | "properties": {
29 | "bar": {
30 | "type": "string",
31 | "minLength": 4,
32 | "default": "bad"
33 | }
34 | }
35 | },
36 | "tests": [
37 | {
38 | "description": "valid when property is specified",
39 | "data": {"bar": "good"},
40 | "valid": true
41 | },
42 | {
43 | "description": "still valid when the invalid default is used",
44 | "data": {},
45 | "valid": true
46 | }
47 | ]
48 | }
49 | ]
50 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/definitions.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "valid definition",
4 | "schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
5 | "tests": [
6 | {
7 | "description": "valid definition schema",
8 | "data": {
9 | "definitions": {
10 | "foo": {"type": "integer"}
11 | }
12 | },
13 | "valid": true
14 | }
15 | ]
16 | },
17 | {
18 | "description": "invalid definition",
19 | "schema": {"$ref": "http://json-schema.org/draft-04/schema#"},
20 | "tests": [
21 | {
22 | "description": "invalid definition schema",
23 | "data": {
24 | "definitions": {
25 | "foo": {"type": 1}
26 | }
27 | },
28 | "valid": false
29 | }
30 | ]
31 | }
32 | ]
33 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/enum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "simple enum validation",
4 | "schema": {"enum": [1, 2, 3]},
5 | "tests": [
6 | {
7 | "description": "one of the enum is valid",
8 | "data": 1,
9 | "valid": true
10 | },
11 | {
12 | "description": "something else is invalid",
13 | "data": 4,
14 | "valid": false
15 | }
16 | ]
17 | },
18 | {
19 | "description": "heterogeneous enum validation",
20 | "schema": {"enum": [6, "foo", [], true, {"foo": 12}]},
21 | "tests": [
22 | {
23 | "description": "one of the enum is valid",
24 | "data": [],
25 | "valid": true
26 | },
27 | {
28 | "description": "something else is invalid",
29 | "data": null,
30 | "valid": false
31 | },
32 | {
33 | "description": "objects are deep compared",
34 | "data": {"foo": false},
35 | "valid": false
36 | }
37 | ]
38 | },
39 | {
40 | "description": "enums in properties",
41 | "schema": {
42 | "type":"object",
43 | "properties": {
44 | "foo": {"enum":["foo"]},
45 | "bar": {"enum":["bar"]}
46 | },
47 | "required": ["bar"]
48 | },
49 | "tests": [
50 | {
51 | "description": "both properties are valid",
52 | "data": {"foo":"foo", "bar":"bar"},
53 | "valid": true
54 | },
55 | {
56 | "description": "missing optional property is valid",
57 | "data": {"bar":"bar"},
58 | "valid": true
59 | },
60 | {
61 | "description": "missing required property is invalid",
62 | "data": {"foo":"foo"},
63 | "valid": false
64 | },
65 | {
66 | "description": "missing all properties is invalid",
67 | "data": {},
68 | "valid": false
69 | }
70 | ]
71 | }
72 | ]
73 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/items.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "a schema given for items",
4 | "schema": {
5 | "items": {"type": "integer"}
6 | },
7 | "tests": [
8 | {
9 | "description": "valid items",
10 | "data": [ 1, 2, 3 ],
11 | "valid": true
12 | },
13 | {
14 | "description": "wrong type of items",
15 | "data": [1, "x"],
16 | "valid": false
17 | },
18 | {
19 | "description": "ignores non-arrays",
20 | "data": {"foo" : "bar"},
21 | "valid": true
22 | }
23 | ]
24 | },
25 | {
26 | "description": "an array of schemas for items",
27 | "schema": {
28 | "items": [
29 | {"type": "integer"},
30 | {"type": "string"}
31 | ]
32 | },
33 | "tests": [
34 | {
35 | "description": "correct types",
36 | "data": [ 1, "foo" ],
37 | "valid": true
38 | },
39 | {
40 | "description": "wrong types",
41 | "data": [ "foo", 1 ],
42 | "valid": false
43 | }
44 | ]
45 | }
46 | ]
47 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/maxItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxItems validation",
4 | "schema": {"maxItems": 2},
5 | "tests": [
6 | {
7 | "description": "shorter is valid",
8 | "data": [1],
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": [1, 2],
14 | "valid": true
15 | },
16 | {
17 | "description": "too long is invalid",
18 | "data": [1, 2, 3],
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-arrays",
23 | "data": "foobar",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/maxLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxLength validation",
4 | "schema": {"maxLength": 2},
5 | "tests": [
6 | {
7 | "description": "shorter is valid",
8 | "data": "f",
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": "fo",
14 | "valid": true
15 | },
16 | {
17 | "description": "too long is invalid",
18 | "data": "foo",
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-strings",
23 | "data": 100,
24 | "valid": true
25 | },
26 | {
27 | "description": "two supplementary Unicode code points is long enough",
28 | "data": "\uD83D\uDCA9\uD83D\uDCA9",
29 | "valid": true
30 | }
31 | ]
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/maxProperties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maxProperties validation",
4 | "schema": {"maxProperties": 2},
5 | "tests": [
6 | {
7 | "description": "shorter is valid",
8 | "data": {"foo": 1},
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": {"foo": 1, "bar": 2},
14 | "valid": true
15 | },
16 | {
17 | "description": "too long is invalid",
18 | "data": {"foo": 1, "bar": 2, "baz": 3},
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-objects",
23 | "data": "foobar",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/maximum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "maximum validation",
4 | "schema": {"maximum": 3.0},
5 | "tests": [
6 | {
7 | "description": "below the maximum is valid",
8 | "data": 2.6,
9 | "valid": true
10 | },
11 | {
12 | "description": "above the maximum is invalid",
13 | "data": 3.5,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "x",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "exclusiveMaximum validation",
25 | "schema": {
26 | "maximum": 3.0,
27 | "exclusiveMaximum": true
28 | },
29 | "tests": [
30 | {
31 | "description": "below the maximum is still valid",
32 | "data": 2.2,
33 | "valid": true
34 | },
35 | {
36 | "description": "boundary point is invalid",
37 | "data": 3.0,
38 | "valid": false
39 | }
40 | ]
41 | }
42 | ]
43 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/minItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minItems validation",
4 | "schema": {"minItems": 1},
5 | "tests": [
6 | {
7 | "description": "longer is valid",
8 | "data": [1, 2],
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": [1],
14 | "valid": true
15 | },
16 | {
17 | "description": "too short is invalid",
18 | "data": [],
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-arrays",
23 | "data": "",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/minLength.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minLength validation",
4 | "schema": {"minLength": 2},
5 | "tests": [
6 | {
7 | "description": "longer is valid",
8 | "data": "foo",
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": "fo",
14 | "valid": true
15 | },
16 | {
17 | "description": "too short is invalid",
18 | "data": "f",
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-strings",
23 | "data": 1,
24 | "valid": true
25 | },
26 | {
27 | "description": "one supplementary Unicode code point is not long enough",
28 | "data": "\uD83D\uDCA9",
29 | "valid": false
30 | }
31 | ]
32 | }
33 | ]
34 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/minProperties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minProperties validation",
4 | "schema": {"minProperties": 1},
5 | "tests": [
6 | {
7 | "description": "longer is valid",
8 | "data": {"foo": 1, "bar": 2},
9 | "valid": true
10 | },
11 | {
12 | "description": "exact length is valid",
13 | "data": {"foo": 1},
14 | "valid": true
15 | },
16 | {
17 | "description": "too short is invalid",
18 | "data": {},
19 | "valid": false
20 | },
21 | {
22 | "description": "ignores non-objects",
23 | "data": "",
24 | "valid": true
25 | }
26 | ]
27 | }
28 | ]
29 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/minimum.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "minimum validation",
4 | "schema": {"minimum": 1.1},
5 | "tests": [
6 | {
7 | "description": "above the minimum is valid",
8 | "data": 2.6,
9 | "valid": true
10 | },
11 | {
12 | "description": "below the minimum is invalid",
13 | "data": 0.6,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "x",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "exclusiveMinimum validation",
25 | "schema": {
26 | "minimum": 1.1,
27 | "exclusiveMinimum": true
28 | },
29 | "tests": [
30 | {
31 | "description": "above the minimum is still valid",
32 | "data": 1.2,
33 | "valid": true
34 | },
35 | {
36 | "description": "boundary point is invalid",
37 | "data": 1.1,
38 | "valid": false
39 | }
40 | ]
41 | }
42 | ]
43 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/multipleOf.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "by int",
4 | "schema": {"multipleOf": 2},
5 | "tests": [
6 | {
7 | "description": "int by int",
8 | "data": 10,
9 | "valid": true
10 | },
11 | {
12 | "description": "int by int fail",
13 | "data": 7,
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-numbers",
18 | "data": "foo",
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "by number",
25 | "schema": {"multipleOf": 1.5},
26 | "tests": [
27 | {
28 | "description": "zero is multiple of anything",
29 | "data": 0,
30 | "valid": true
31 | },
32 | {
33 | "description": "4.5 is multiple of 1.5",
34 | "data": 4.5,
35 | "valid": true
36 | },
37 | {
38 | "description": "35 is not multiple of 1.5",
39 | "data": 35,
40 | "valid": false
41 | }
42 | ]
43 | },
44 | {
45 | "description": "by small number",
46 | "schema": {"multipleOf": 0.0001},
47 | "tests": [
48 | {
49 | "description": "0.0075 is multiple of 0.0001",
50 | "data": 0.0075,
51 | "valid": true
52 | },
53 | {
54 | "description": "0.00751 is not multiple of 0.0001",
55 | "data": 0.00751,
56 | "valid": false
57 | }
58 | ]
59 | }
60 | ]
61 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/not.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "not",
4 | "schema": {
5 | "not": {"type": "integer"}
6 | },
7 | "tests": [
8 | {
9 | "description": "allowed",
10 | "data": "foo",
11 | "valid": true
12 | },
13 | {
14 | "description": "disallowed",
15 | "data": 1,
16 | "valid": false
17 | }
18 | ]
19 | },
20 | {
21 | "description": "not multiple types",
22 | "schema": {
23 | "not": {"type": ["integer", "boolean"]}
24 | },
25 | "tests": [
26 | {
27 | "description": "valid",
28 | "data": "foo",
29 | "valid": true
30 | },
31 | {
32 | "description": "mismatch",
33 | "data": 1,
34 | "valid": false
35 | },
36 | {
37 | "description": "other mismatch",
38 | "data": true,
39 | "valid": false
40 | }
41 | ]
42 | },
43 | {
44 | "description": "not more complex schema",
45 | "schema": {
46 | "not": {
47 | "type": "object",
48 | "properties": {
49 | "foo": {
50 | "type": "string"
51 | }
52 | }
53 | }
54 | },
55 | "tests": [
56 | {
57 | "description": "match",
58 | "data": 1,
59 | "valid": true
60 | },
61 | {
62 | "description": "other match",
63 | "data": {"foo": 1},
64 | "valid": true
65 | },
66 | {
67 | "description": "mismatch",
68 | "data": {"foo": "bar"},
69 | "valid": false
70 | }
71 | ]
72 | },
73 | {
74 | "description": "forbidden property",
75 | "schema": {
76 | "properties": {
77 | "foo": {
78 | "not": {}
79 | }
80 | }
81 | },
82 | "tests": [
83 | {
84 | "description": "property present",
85 | "data": {"foo": 1, "bar": 2},
86 | "valid": false
87 | },
88 | {
89 | "description": "property absent",
90 | "data": {"bar": 1, "baz": 2},
91 | "valid": true
92 | }
93 | ]
94 | }
95 |
96 | ]
97 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/oneOf.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "oneOf",
4 | "schema": {
5 | "oneOf": [
6 | {
7 | "type": "integer"
8 | },
9 | {
10 | "minimum": 2
11 | }
12 | ]
13 | },
14 | "tests": [
15 | {
16 | "description": "first oneOf valid",
17 | "data": 1,
18 | "valid": true
19 | },
20 | {
21 | "description": "second oneOf valid",
22 | "data": 2.5,
23 | "valid": true
24 | },
25 | {
26 | "description": "both oneOf valid",
27 | "data": 3,
28 | "valid": false
29 | },
30 | {
31 | "description": "neither oneOf valid",
32 | "data": 1.5,
33 | "valid": false
34 | }
35 | ]
36 | },
37 | {
38 | "description": "oneOf with base schema",
39 | "schema": {
40 | "type": "string",
41 | "oneOf" : [
42 | {
43 | "minLength": 2
44 | },
45 | {
46 | "maxLength": 4
47 | }
48 | ]
49 | },
50 | "tests": [
51 | {
52 | "description": "mismatch base schema",
53 | "data": 3,
54 | "valid": false
55 | },
56 | {
57 | "description": "one oneOf valid",
58 | "data": "foobar",
59 | "valid": true
60 | },
61 | {
62 | "description": "both oneOf valid",
63 | "data": "foo",
64 | "valid": false
65 | }
66 | ]
67 | }
68 | ]
69 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/optional/zeroTerminatedFloats.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "some languages do not distinguish between different types of numeric value",
4 | "schema": {
5 | "type": "integer"
6 | },
7 | "tests": [
8 | {
9 | "description": "a float is not an integer even without fractional part",
10 | "data": 1.0,
11 | "valid": false
12 | }
13 | ]
14 | }
15 | ]
16 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/pattern.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "pattern validation",
4 | "schema": {"pattern": "^a*$"},
5 | "tests": [
6 | {
7 | "description": "a matching pattern is valid",
8 | "data": "aaa",
9 | "valid": true
10 | },
11 | {
12 | "description": "a non-matching pattern is invalid",
13 | "data": "abc",
14 | "valid": false
15 | },
16 | {
17 | "description": "ignores non-strings",
18 | "data": true,
19 | "valid": true
20 | }
21 | ]
22 | },
23 | {
24 | "description": "pattern is not anchored",
25 | "schema": {"pattern": "a+"},
26 | "tests": [
27 | {
28 | "description": "matches a substring",
29 | "data": "xxaayy",
30 | "valid": true
31 | }
32 | ]
33 | }
34 | ]
35 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/properties.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "object properties validation",
4 | "schema": {
5 | "properties": {
6 | "foo": {"type": "integer"},
7 | "bar": {"type": "string"}
8 | }
9 | },
10 | "tests": [
11 | {
12 | "description": "both properties present and valid is valid",
13 | "data": {"foo": 1, "bar": "baz"},
14 | "valid": true
15 | },
16 | {
17 | "description": "one property invalid is invalid",
18 | "data": {"foo": 1, "bar": {}},
19 | "valid": false
20 | },
21 | {
22 | "description": "both properties invalid is invalid",
23 | "data": {"foo": [], "bar": {}},
24 | "valid": false
25 | },
26 | {
27 | "description": "doesn't invalidate other properties",
28 | "data": {"quux": []},
29 | "valid": true
30 | },
31 | {
32 | "description": "ignores non-objects",
33 | "data": [],
34 | "valid": true
35 | }
36 | ]
37 | },
38 | {
39 | "description":
40 | "properties, patternProperties, additionalProperties interaction",
41 | "schema": {
42 | "properties": {
43 | "foo": {"type": "array", "maxItems": 3},
44 | "bar": {"type": "array"}
45 | },
46 | "patternProperties": {"f.o": {"minItems": 2}},
47 | "additionalProperties": {"type": "integer"}
48 | },
49 | "tests": [
50 | {
51 | "description": "property validates property",
52 | "data": {"foo": [1, 2]},
53 | "valid": true
54 | },
55 | {
56 | "description": "property invalidates property",
57 | "data": {"foo": [1, 2, 3, 4]},
58 | "valid": false
59 | },
60 | {
61 | "description": "patternProperty invalidates property",
62 | "data": {"foo": []},
63 | "valid": false
64 | },
65 | {
66 | "description": "patternProperty validates nonproperty",
67 | "data": {"fxo": [1, 2]},
68 | "valid": true
69 | },
70 | {
71 | "description": "patternProperty invalidates nonproperty",
72 | "data": {"fxo": []},
73 | "valid": false
74 | },
75 | {
76 | "description": "additionalProperty ignores property",
77 | "data": {"bar": []},
78 | "valid": true
79 | },
80 | {
81 | "description": "additionalProperty validates others",
82 | "data": {"quux": 3},
83 | "valid": true
84 | },
85 | {
86 | "description": "additionalProperty invalidates others",
87 | "data": {"quux": "foo"},
88 | "valid": false
89 | }
90 | ]
91 | }
92 | ]
93 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/refRemote.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "remote ref",
4 | "schema": {"$ref": "http://localhost:1234/integer.json"},
5 | "tests": [
6 | {
7 | "description": "remote ref valid",
8 | "data": 1,
9 | "valid": true
10 | },
11 | {
12 | "description": "remote ref invalid",
13 | "data": "a",
14 | "valid": false
15 | }
16 | ]
17 | },
18 | {
19 | "description": "fragment within remote ref",
20 | "schema": {"$ref": "http://localhost:1234/subSchemas.json#/integer"},
21 | "tests": [
22 | {
23 | "description": "remote fragment valid",
24 | "data": 1,
25 | "valid": true
26 | },
27 | {
28 | "description": "remote fragment invalid",
29 | "data": "a",
30 | "valid": false
31 | }
32 | ]
33 | },
34 | {
35 | "description": "ref within remote ref",
36 | "schema": {
37 | "$ref": "http://localhost:1234/subSchemas.json#/refToInteger"
38 | },
39 | "tests": [
40 | {
41 | "description": "ref within ref valid",
42 | "data": 1,
43 | "valid": true
44 | },
45 | {
46 | "description": "ref within ref invalid",
47 | "data": "a",
48 | "valid": false
49 | }
50 | ]
51 | },
52 | {
53 | "description": "change resolution scope",
54 | "schema": {
55 | "id": "http://localhost:1234/",
56 | "items": {
57 | "id": "folder/",
58 | "items": {"$ref": "folderInteger.json"}
59 | }
60 | },
61 | "tests": [
62 | {
63 | "description": "changed scope ref valid",
64 | "data": [[1]],
65 | "valid": true
66 | },
67 | {
68 | "description": "changed scope ref invalid",
69 | "data": [["a"]],
70 | "valid": false
71 | }
72 | ]
73 | }
74 | ]
75 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/required.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "required validation",
4 | "schema": {
5 | "properties": {
6 | "foo": {},
7 | "bar": {}
8 | },
9 | "required": ["foo"]
10 | },
11 | "tests": [
12 | {
13 | "description": "present required property is valid",
14 | "data": {"foo": 1},
15 | "valid": true
16 | },
17 | {
18 | "description": "non-present required property is invalid",
19 | "data": {"bar": 1},
20 | "valid": false
21 | }
22 | ]
23 | },
24 | {
25 | "description": "required default validation",
26 | "schema": {
27 | "properties": {
28 | "foo": {}
29 | }
30 | },
31 | "tests": [
32 | {
33 | "description": "not required by default",
34 | "data": {},
35 | "valid": true
36 | }
37 | ]
38 | }
39 | ]
40 |
--------------------------------------------------------------------------------
/bin/jsonschema/tests/draft4/uniqueItems.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "description": "uniqueItems validation",
4 | "schema": {"uniqueItems": true},
5 | "tests": [
6 | {
7 | "description": "unique array of integers is valid",
8 | "data": [1, 2],
9 | "valid": true
10 | },
11 | {
12 | "description": "non-unique array of integers is invalid",
13 | "data": [1, 1],
14 | "valid": false
15 | },
16 | {
17 | "description": "numbers are unique if mathematically unequal",
18 | "data": [1.0, 1.00, 1],
19 | "valid": false
20 | },
21 | {
22 | "description": "unique array of objects is valid",
23 | "data": [{"foo": "bar"}, {"foo": "baz"}],
24 | "valid": true
25 | },
26 | {
27 | "description": "non-unique array of objects is invalid",
28 | "data": [{"foo": "bar"}, {"foo": "bar"}],
29 | "valid": false
30 | },
31 | {
32 | "description": "unique array of nested objects is valid",
33 | "data": [
34 | {"foo": {"bar" : {"baz" : true}}},
35 | {"foo": {"bar" : {"baz" : false}}}
36 | ],
37 | "valid": true
38 | },
39 | {
40 | "description": "non-unique array of nested objects is invalid",
41 | "data": [
42 | {"foo": {"bar" : {"baz" : true}}},
43 | {"foo": {"bar" : {"baz" : true}}}
44 | ],
45 | "valid": false
46 | },
47 | {
48 | "description": "unique array of arrays is valid",
49 | "data": [["foo"], ["bar"]],
50 | "valid": true
51 | },
52 | {
53 | "description": "non-unique array of arrays is invalid",
54 | "data": [["foo"], ["foo"]],
55 | "valid": false
56 | },
57 | {
58 | "description": "1 and true are unique",
59 | "data": [1, true],
60 | "valid": true
61 | },
62 | {
63 | "description": "0 and false are unique",
64 | "data": [0, false],
65 | "valid": true
66 | },
67 | {
68 | "description": "unique heterogeneous types are valid",
69 | "data": [{}, [1], true, null, 1],
70 | "valid": true
71 | },
72 | {
73 | "description": "non-unique heterogeneous types are invalid",
74 | "data": [{}, [1], true, null, {}, 1],
75 | "valid": false
76 | }
77 | ]
78 | }
79 | ]
80 |
--------------------------------------------------------------------------------
/bin/jsonschema/tox.ini:
--------------------------------------------------------------------------------
1 | [tox]
2 | minversion = 1.6
3 | envlist = py27
4 | skipsdist = True
5 |
6 | [testenv]
7 | deps = jsonschema
8 | commands = {envpython} bin/jsonschema_suite check
9 |
--------------------------------------------------------------------------------
/bin/types/booleans.json:
--------------------------------------------------------------------------------
1 | [
2 | true,
3 | true,
4 | false,
5 | false,
6 | true,
7 | true,
8 | true,
9 | false,
10 | false,
11 | true,
12 | false,
13 | false,
14 | true,
15 | false,
16 | false,
17 | false,
18 | true,
19 | false,
20 | false,
21 | true,
22 | true,
23 | false,
24 | true,
25 | true,
26 | true,
27 | false,
28 | false,
29 | false,
30 | true,
31 | false,
32 | true,
33 | false,
34 | false,
35 | true,
36 | true,
37 | true,
38 | true,
39 | true,
40 | true,
41 | false,
42 | false,
43 | true,
44 | false,
45 | false,
46 | false,
47 | true,
48 | true,
49 | false,
50 | true,
51 | true,
52 | false,
53 | true,
54 | false,
55 | true,
56 | true,
57 | true,
58 | false,
59 | false,
60 | false,
61 | true,
62 | false,
63 | false,
64 | false,
65 | true,
66 | true,
67 | false,
68 | true,
69 | true,
70 | true,
71 | true,
72 | true,
73 | true,
74 | true,
75 | true,
76 | false,
77 | false,
78 | false,
79 | false,
80 | false,
81 | true,
82 | true,
83 | true,
84 | true,
85 | true,
86 | true,
87 | true,
88 | false,
89 | false,
90 | false,
91 | true,
92 | false,
93 | false,
94 | false,
95 | true,
96 | true,
97 | true,
98 | false,
99 | false,
100 | true,
101 | false
102 | ]
--------------------------------------------------------------------------------
/bin/types/floats.json:
--------------------------------------------------------------------------------
1 | [
2 | 135.747111636,
3 | 123.377054008,
4 | 140.527504552,
5 | -72.299143906,
6 | -23.851678949,
7 | 73.586193519,
8 | -158.299382442,
9 | 177.477876032,
10 | 32.268518982,
11 | -139.560009969,
12 | 115.203105183,
13 | -106.025823607,
14 | 167.224138231,
15 | 103.378383732,
16 | -97.498486285,
17 | 18.184723416,
18 | 69.137075711,
19 | 33.849002681,
20 | -120.185228215,
21 | -20.841408615,
22 | -172.659492727,
23 | -2.691464061,
24 | 22.426164066,
25 | -98.416909437,
26 | -31.603082708,
27 | -85.072296561,
28 | 108.620987395,
29 | -43.127078238,
30 | -126.473562057,
31 | -158.595489097,
32 | -57.890678254,
33 | -13.254016573,
34 | -85.024504709,
35 | 171.663552644,
36 | -146.495558248,
37 | -10.606748276,
38 | -118.786969354,
39 | 153.352057804,
40 | -45.215545083,
41 | 37.038725288,
42 | 106.344071897,
43 | -64.607402031,
44 | 85.148030911,
45 | 28.897784566,
46 | 39.51082061,
47 | 20.450382102,
48 | -113.174943618,
49 | 71.60785784,
50 | -168.202648062,
51 | -157.338200017,
52 | 10.879588527,
53 | -114.261694831,
54 | -5.622927072,
55 | -173.330830616,
56 | -29.47002003,
57 | -39.829034201,
58 | 50.031545162,
59 | 82.815735508,
60 | -119.188760828,
61 | -48.455928081,
62 | 163.964263034,
63 | 46.30378861,
64 | -26.248889762,
65 | -47.354615322,
66 | 155.388677633,
67 | -166.710356904,
68 | 42.987233558,
69 | 144.275297374,
70 | 37.394383186,
71 | -122.550388725,
72 | 177.469945914,
73 | 101.104677413,
74 | 109.429869885,
75 | -104.919625624,
76 | 147.522756541,
77 | -81.294703727,
78 | 122.744731363,
79 | 81.803603684,
80 | 26.321556167,
81 | 147.045441354,
82 | 147.256895816,
83 | -174.211095908,
84 | 52.518769316,
85 | -78.58250334,
86 | -173.356685435,
87 | -107.728209264,
88 | -69.982325771,
89 | -113.776095893,
90 | -35.785267074,
91 | -105.748545976,
92 | -30.206523864,
93 | -76.185311723,
94 | -126.400112781,
95 | -26.864958639,
96 | 56.840053629,
97 | 93.781553535,
98 | -116.002949803,
99 | -46.617140948,
100 | 176.846840093,
101 | -144.24821335
102 | ]
103 |
--------------------------------------------------------------------------------
/bin/types/integers.json:
--------------------------------------------------------------------------------
1 | [
2 | 8125686,
3 | 8958709,
4 | 5976222,
5 | 1889524,
6 | 7968493,
7 | 1357486,
8 | 118415,
9 | 7081097,
10 | 4635968,
11 | 7555332,
12 | 2270233,
13 | 3428352,
14 | 8699968,
15 | 2087333,
16 | 7861337,
17 | 7554440,
18 | 2017031,
19 | 7981692,
20 | 6060687,
21 | 1877715,
22 | 3297474,
23 | 8373177,
24 | 6158629,
25 | 7853641,
26 | 3004441,
27 | 9650406,
28 | 2695251,
29 | 1180761,
30 | 4988426,
31 | 6043805,
32 | 8063373,
33 | 6103218,
34 | 2848339,
35 | 8188690,
36 | 9235573,
37 | 5949816,
38 | 6116081,
39 | 6471138,
40 | 3354531,
41 | 4787414,
42 | 9660600,
43 | 942529,
44 | 7278535,
45 | 7967399,
46 | 554292,
47 | 1436493,
48 | 267319,
49 | 2606657,
50 | 7900601,
51 | 4276634,
52 | 7996757,
53 | 8544466,
54 | 7266469,
55 | 3301373,
56 | 4005350,
57 | 6437652,
58 | 7717672,
59 | 7126292,
60 | 8588394,
61 | 2127902,
62 | 7410190,
63 | 1517806,
64 | 4583602,
65 | 3123440,
66 | 7747613,
67 | 5029464,
68 | 9834390,
69 | 3087227,
70 | 4913822,
71 | 7550487,
72 | 4518144,
73 | 5862588,
74 | 1778599,
75 | 9493290,
76 | 5588455,
77 | 3638706,
78 | 7394293,
79 | 4294719,
80 | 3837830,
81 | 6381878,
82 | 7175866,
83 | 8575492,
84 | 1415229,
85 | 1453733,
86 | 6972404,
87 | 9782571,
88 | 4234063,
89 | 7117418,
90 | 7293130,
91 | 8057071,
92 | 9345285,
93 | 7626648,
94 | 3358911,
95 | 4574537,
96 | 9371826,
97 | 7627107,
98 | 6154093,
99 | 5392367,
100 | 5398105,
101 | 6956377
102 | ]
--------------------------------------------------------------------------------
/bin/types/nulls.json:
--------------------------------------------------------------------------------
1 | [
2 | null,
3 | null,
4 | null,
5 | null,
6 | null,
7 | null,
8 | null,
9 | null,
10 | null,
11 | null,
12 | null,
13 | null,
14 | null,
15 | null,
16 | null,
17 | null,
18 | null,
19 | null,
20 | null,
21 | null,
22 | null,
23 | null,
24 | null,
25 | null,
26 | null,
27 | null,
28 | null,
29 | null,
30 | null,
31 | null,
32 | null,
33 | null,
34 | null,
35 | null,
36 | null,
37 | null,
38 | null,
39 | null,
40 | null,
41 | null,
42 | null,
43 | null,
44 | null,
45 | null,
46 | null,
47 | null,
48 | null,
49 | null,
50 | null,
51 | null,
52 | null,
53 | null,
54 | null,
55 | null,
56 | null,
57 | null,
58 | null,
59 | null,
60 | null,
61 | null,
62 | null,
63 | null,
64 | null,
65 | null,
66 | null,
67 | null,
68 | null,
69 | null,
70 | null,
71 | null,
72 | null,
73 | null,
74 | null,
75 | null,
76 | null,
77 | null,
78 | null,
79 | null,
80 | null,
81 | null,
82 | null,
83 | null,
84 | null,
85 | null,
86 | null,
87 | null,
88 | null,
89 | null,
90 | null,
91 | null,
92 | null,
93 | null,
94 | null,
95 | null,
96 | null,
97 | null,
98 | null,
99 | null,
100 | null,
101 | null
102 | ]
--------------------------------------------------------------------------------
/bin/types/readme.txt:
--------------------------------------------------------------------------------
1 | Test data obtained from https://github.com/xpol/lua-rapidjson/tree/master/performance
2 |
--------------------------------------------------------------------------------
/bin/unittestschema/allOf_address.json:
--------------------------------------------------------------------------------
1 | {
2 | "allOf": [
3 | {
4 | "$ref": "http://localhost:1234/address.json#"
5 | }
6 | ]
7 | }
--------------------------------------------------------------------------------
/bin/unittestschema/anyOf_address.json:
--------------------------------------------------------------------------------
1 | {
2 | "anyOf": [
3 | {
4 | "$ref": "http://localhost:1234/address.json#"
5 | }
6 | ]
7 | }
--------------------------------------------------------------------------------
/bin/unittestschema/idandref.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "http://example.com/root.json",
3 | "definitions": {
4 | "A": {
5 | "id": "#foo",
6 | "type": "integer"
7 | },
8 | "B": {
9 | "id": "other.json",
10 | "definitions": {
11 | "X": {
12 | "id": "#bar",
13 | "type": "boolean"
14 | },
15 | "Y": {
16 | "$ref": "#/definitions/X"
17 | },
18 | "W": {
19 | "$ref": "#/definitions/Y"
20 | },
21 | "Z": {
22 | "$ref": "#bar"
23 | },
24 | "N": {
25 | "properties": {
26 | "NX": {
27 | "$ref": "#/definitions/X"
28 | }
29 | }
30 | }
31 | }
32 | }
33 | },
34 | "properties": {
35 | "PA1": {
36 | "$ref": "http://example.com/root.json#/definitions/A"
37 | },
38 | "PA2": {
39 | "$ref": "#/definitions/A"
40 | },
41 | "PA3": {
42 | "$ref": "#foo"
43 | },
44 | "PX1": {
45 | "$ref": "#/definitions/B/definitions/X"
46 | },
47 | "PX2Y": {
48 | "$ref": "#/definitions/B/definitions/Y"
49 | },
50 | "PX3Z": {
51 | "$ref": "#/definitions/B/definitions/Z"
52 | },
53 | "PX4": {
54 | "$ref": "http://example.com/other.json#/definitions/X"
55 | },
56 | "PX5": {
57 | "$ref": "other.json#/definitions/X"
58 | },
59 | "PX6": {
60 | "$ref": "other.json#bar"
61 | },
62 | "PX7W": {
63 | "$ref": "#/definitions/B/definitions/W"
64 | },
65 | "PX8N": {
66 | "$ref": "#/definitions/B/definitions/N"
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/bin/unittestschema/oneOf_address.json:
--------------------------------------------------------------------------------
1 | {
2 | "oneOf": [
3 | {
4 | "$ref": "http://localhost:1234/address.json#"
5 | }
6 | ]
7 | }
--------------------------------------------------------------------------------
/contrib/natvis/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Bart Muzzin
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 | Derived from:
24 |
25 | The MIT License (MIT)
26 |
27 | Copyright (c) 2015 mojmir svoboda
28 |
29 | Permission is hereby granted, free of charge, to any person obtaining a copy
30 | of this software and associated documentation files (the "Software"), to deal
31 | in the Software without restriction, including without limitation the rights
32 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33 | copies of the Software, and to permit persons to whom the Software is
34 | furnished to do so, subject to the following conditions:
35 |
36 | The above copyright notice and this permission notice shall be included in all
37 | copies or substantial portions of the Software.
38 |
39 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45 | SOFTWARE.
46 |
--------------------------------------------------------------------------------
/contrib/natvis/README.md:
--------------------------------------------------------------------------------
1 | # rapidjson.natvis
2 |
3 | This file can be used as a [Visual Studio Visualizer](https://docs.microsoft.com/en-gb/visualstudio/debugger/create-custom-views-of-native-objects) to aid in visualizing rapidjson structures within the Visual Studio debugger. Natvis visualizers are supported in Visual Studio 2012 and later. To install, copy the file into this directory:
4 |
5 | `%USERPROFILE%\Documents\Visual Studio 2012\Visualizers`
6 |
7 | Each version of Visual Studio has a similar directory, it must be copied into each directory to be used with that particular version. In Visual Studio 2015 and later, this can be done without restarting Visual Studio (a new debugging session must be started).
8 |
--------------------------------------------------------------------------------
/contrib/natvis/rapidjson.natvis:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | null
6 | true
7 | false
8 | {(const Ch*)data_.ss.str,na}
9 | {(const Ch*)((size_t)data_.s.str & 0x0000FFFFFFFFFFFF),[data_.s.length]na}
10 | {data_.n.i.i}
11 | {data_.n.u.u}
12 | {data_.n.i64}
13 | {data_.n.u64}
14 | {data_.n.d}
15 | Object members={data_.o.size}
16 | Array members={data_.a.size}
17 |
18 | - data_.o.size
19 | - data_.o.capacity
20 |
21 | data_.o.size
22 |
23 | (rapidjson::GenericMember<$T1,$T2>*)(((size_t)data_.o.members) & 0x0000FFFFFFFFFFFF)
24 |
25 |
26 | - data_.a.size
27 | - data_.a.capacity
28 |
29 | data_.a.size
30 |
31 | (rapidjson::GenericValue<$T1,$T2>*)(((size_t)data_.a.elements) & 0x0000FFFFFFFFFFFF)
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/doc/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | find_package(Doxygen)
2 |
3 | IF(NOT DOXYGEN_FOUND)
4 | MESSAGE(STATUS "No Doxygen found. Documentation won't be built")
5 | ELSE()
6 | file(GLOB SOURCES ${CMAKE_CURRENT_LIST_DIR}/../include/*)
7 | file(GLOB MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../doc/*.md)
8 | list(APPEND MARKDOWN_DOC ${CMAKE_CURRENT_LIST_DIR}/../readme.md)
9 |
10 | CONFIGURE_FILE(Doxyfile.in Doxyfile @ONLY)
11 | CONFIGURE_FILE(Doxyfile.zh-cn.in Doxyfile.zh-cn @ONLY)
12 |
13 | file(GLOB DOXYFILES ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile*)
14 |
15 | add_custom_command(OUTPUT html
16 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
17 | COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.zh-cn
18 | COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/html
19 | DEPENDS ${MARKDOWN_DOC} ${SOURCES} ${DOXYFILES}
20 | WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../
21 | )
22 |
23 | add_custom_target(doc ALL DEPENDS html)
24 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
25 | DESTINATION ${DOC_INSTALL_DIR}
26 | COMPONENT doc)
27 | ENDIF()
28 |
--------------------------------------------------------------------------------
/doc/diagram/architecture.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | nodesep=0.5
8 | penwidth=0.5
9 | colorscheme=spectral7
10 |
11 | node [shape=box, fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5, style=filled, fillcolor=white]
12 | edge [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
13 |
14 | subgraph cluster1 {
15 | margin="10,10"
16 | labeljust="left"
17 | label = "SAX"
18 | style=filled
19 | fillcolor=6
20 |
21 | Reader -> Writer [style=invis]
22 | }
23 |
24 | subgraph cluster2 {
25 | margin="10,10"
26 | labeljust="left"
27 | label = "DOM"
28 | style=filled
29 | fillcolor=7
30 |
31 | Value
32 | Document
33 | }
34 |
35 | Handler [label="<>\nHandler"]
36 |
37 | {
38 | edge [arrowtail=onormal, dir=back]
39 | Value -> Document
40 | Handler -> Document
41 | Handler -> Writer
42 | }
43 |
44 | {
45 | edge [arrowhead=vee, style=dashed, constraint=false]
46 | Reader -> Handler [label="calls"]
47 | Value -> Handler [label="calls"]
48 | Document -> Reader [label="uses"]
49 | }
50 | }
--------------------------------------------------------------------------------
/doc/diagram/architecture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/architecture.png
--------------------------------------------------------------------------------
/doc/diagram/insituparsing.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
11 |
12 | {
13 | node [shape=record, fontsize="8", margin="0.04", height=0.2, color=gray]
14 | oldjson [label="\{|\"|m|s|g|\"|:|\"|H|e|l|l|o|\\|n|W|o|r|l|d|!|\"|,|\"|\\|u|0|0|7|3|t|a|r|s|\"|:|1|0|\}", xlabel="Before Parsing"]
15 | //newjson [label="\{|\"|m|s|g|\\0|:|\"|H|e|l|l|o|\\n|W|o|r|l|d|!|\\0|\"|,|\"|s|t|a|r|s|\\0|t|a|r|s|:|1|0|\}", xlabel="After Parsing"]
16 | newjson [shape=plaintext, label=<
17 |
18 | { |
19 | " | m | s | g | \\0 |
20 | : |
21 | " | H | e | l | l | o | \\n | W | o | r | l | d | ! | \\0 | " |
22 | , |
23 | " | s | t | a | r | s | \\0 | t | a | r | s |
24 | : |
25 | 1 | 0 |
26 | } |
27 |
28 | >, xlabel="After Parsing"]
29 | }
30 |
31 | subgraph cluster1 {
32 | margin="10,10"
33 | labeljust="left"
34 | label = "Document by In situ Parsing"
35 | style=filled
36 | fillcolor=gray95
37 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
38 |
39 | root [label="{object|}", fillcolor=3]
40 |
41 | {
42 | msg [label="{string|}", fillcolor=5]
43 | helloworld [label="{string|}", fillcolor=5]
44 | stars [label="{string|}", fillcolor=5]
45 | ten [label="{number|10}", fillcolor=6]
46 | }
47 | }
48 |
49 | oldjson -> root [label=" ParseInsitu()" lhead="cluster1"]
50 | edge [arrowhead=vee]
51 | root -> { msg; stars }
52 |
53 | edge [arrowhead="none"]
54 | msg -> helloworld
55 | stars -> ten
56 |
57 | {
58 | edge [arrowhead=vee, arrowtail=dot, arrowsize=0.5, dir=both, tailclip=false]
59 | msg:a:c -> newjson:a
60 | helloworld:a:c -> newjson:b
61 | stars:a:c -> newjson:c
62 | }
63 |
64 | //oldjson -> newjson [style=invis]
65 | }
--------------------------------------------------------------------------------
/doc/diagram/insituparsing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/insituparsing.png
--------------------------------------------------------------------------------
/doc/diagram/iterative-parser-states-diagram.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | fontname="Inconsolata, Consolas"
3 | fontsize=10
4 | margin="0,0"
5 | penwidth=0.0
6 |
7 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
8 | edge [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
9 |
10 | node [shape = doublecircle]; Start; Finish;
11 | node [shape = box; style = "rounded, filled"; fillcolor=white ];
12 |
13 | Start -> ArrayInitial [label=" ["];
14 | Start -> ObjectInitial [label=" {"];
15 |
16 | subgraph clusterArray {
17 | margin="10,10"
18 | style=filled
19 | fillcolor=gray95
20 | label = "Array"
21 |
22 | ArrayInitial; Element; ElementDelimiter; ArrayFinish;
23 | }
24 |
25 | subgraph clusterObject {
26 | margin="10,10"
27 | style=filled
28 | fillcolor=gray95
29 | label = "Object"
30 |
31 | ObjectInitial; MemberKey; KeyValueDelimiter; MemberValue; MemberDelimiter; ObjectFinish;
32 | }
33 |
34 | ArrayInitial -> ArrayInitial [label="["];
35 | ArrayInitial -> ArrayFinish [label=" ]"];
36 | ArrayInitial -> ObjectInitial [label="{", constraint=false];
37 | ArrayInitial -> Element [label="string\nfalse\ntrue\nnull\nnumber"];
38 |
39 | Element -> ArrayFinish [label="]"];
40 | Element -> ElementDelimiter [label=","];
41 |
42 | ElementDelimiter -> ArrayInitial [label=" ["];
43 | ElementDelimiter -> ObjectInitial [label="{"];
44 | ElementDelimiter -> Element [label="string\nfalse\ntrue\nnull\nnumber"];
45 |
46 | ObjectInitial -> ObjectFinish [label=" }"];
47 | ObjectInitial -> MemberKey [label=" string "];
48 |
49 | MemberKey -> KeyValueDelimiter [label=":"];
50 |
51 | KeyValueDelimiter -> ArrayInitial [label="["];
52 | KeyValueDelimiter -> ObjectInitial [label=" {"];
53 | KeyValueDelimiter -> MemberValue [label=" string\n false\n true\n null\n number"];
54 |
55 | MemberValue -> ObjectFinish [label="}"];
56 | MemberValue -> MemberDelimiter [label=","];
57 |
58 | MemberDelimiter -> MemberKey [label=" string "];
59 |
60 | ArrayFinish -> Finish;
61 | ObjectFinish -> Finish;
62 | }
63 |
--------------------------------------------------------------------------------
/doc/diagram/iterative-parser-states-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/iterative-parser-states-diagram.png
--------------------------------------------------------------------------------
/doc/diagram/makefile:
--------------------------------------------------------------------------------
1 | %.pdf: %.dot
2 | dot $< -Tpdf -o $@
3 |
4 | %.png: %.dot
5 | dot $< -Tpng -o $@
6 |
7 | DOTFILES = $(basename $(wildcard *.dot))
8 | all: $(addsuffix .png, $(DOTFILES)) $(addsuffix .pdf, $(DOTFILES))
9 |
--------------------------------------------------------------------------------
/doc/diagram/move1.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
11 |
12 | subgraph cluster1 {
13 | margin="10,10"
14 | labeljust="left"
15 | label = "Before"
16 | style=filled
17 | fillcolor=gray95
18 |
19 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
20 |
21 | {
22 | rank = same
23 | b1 [label="{b:number|456}", fillcolor=6]
24 | a1 [label="{a:number|123}", fillcolor=6]
25 | }
26 |
27 | a1 -> b1 [style="dashed", label="Move", dir=back]
28 | }
29 |
30 | subgraph cluster2 {
31 | margin="10,10"
32 | labeljust="left"
33 | label = "After"
34 | style=filled
35 | fillcolor=gray95
36 |
37 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
38 |
39 | {
40 | rank = same
41 | b2 [label="{b:null|}", fillcolor=1]
42 | a2 [label="{a:number|456}", fillcolor=6]
43 | }
44 | a2 -> b2 [style=invis, dir=back]
45 | }
46 | b1 -> b2 [style=invis]
47 | }
--------------------------------------------------------------------------------
/doc/diagram/move1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/move1.png
--------------------------------------------------------------------------------
/doc/diagram/move2.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
11 |
12 | subgraph cluster1 {
13 | margin="10,10"
14 | labeljust="left"
15 | label = "Before Copying (Hypothetic)"
16 | style=filled
17 | fillcolor=gray95
18 |
19 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
20 |
21 | c1 [label="{contacts:array|}", fillcolor=4]
22 | c11 [label="{|}"]
23 | c12 [label="{|}"]
24 | c13 [shape="none", label="...", style="solid"]
25 | o1 [label="{o:object|}", fillcolor=3]
26 | ghost [label="{o:object|}", style=invis]
27 |
28 | c1 -> o1 [style="dashed", label="AddMember", constraint=false]
29 |
30 | edge [arrowhead=vee]
31 | c1 -> { c11; c12; c13 }
32 | o1 -> ghost [style=invis]
33 | }
34 |
35 | subgraph cluster2 {
36 | margin="10,10"
37 | labeljust="left"
38 | label = "After Copying (Hypothetic)"
39 | style=filled
40 | fillcolor=gray95
41 |
42 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
43 |
44 | c2 [label="{contacts:array|}", fillcolor=4]
45 | c3 [label="{array|}", fillcolor=4]
46 | c21 [label="{|}"]
47 | c22 [label="{|}"]
48 | c23 [shape=none, label="...", style="solid"]
49 | o2 [label="{o:object|}", fillcolor=3]
50 | cs [label="{string|\"contacts\"}", fillcolor=5]
51 | c31 [label="{|}"]
52 | c32 [label="{|}"]
53 | c33 [shape="none", label="...", style="solid"]
54 |
55 | edge [arrowhead=vee]
56 | c2 -> { c21; c22; c23 }
57 | o2 -> cs
58 | cs -> c3 [arrowhead=none]
59 | c3 -> { c31; c32; c33 }
60 | }
61 | ghost -> o2 [style=invis]
62 | }
63 |
--------------------------------------------------------------------------------
/doc/diagram/move2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/move2.png
--------------------------------------------------------------------------------
/doc/diagram/move3.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 | forcelabels=true
9 |
10 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
11 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
12 |
13 | subgraph cluster1 {
14 | margin="10,10"
15 | labeljust="left"
16 | label = "Before Moving"
17 | style=filled
18 | fillcolor=gray95
19 |
20 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
21 |
22 | c1 [label="{contacts:array|}", fillcolor=4]
23 | c11 [label="{|}"]
24 | c12 [label="{|}"]
25 | c13 [shape=none, label="...", style="solid"]
26 | o1 [label="{o:object|}", fillcolor=3]
27 | ghost [label="{o:object|}", style=invis]
28 |
29 | c1 -> o1 [style="dashed", constraint=false, label="AddMember"]
30 |
31 | edge [arrowhead=vee]
32 | c1 -> { c11; c12; c13 }
33 | o1 -> ghost [style=invis]
34 | }
35 |
36 | subgraph cluster2 {
37 | margin="10,10"
38 | labeljust="left"
39 | label = "After Moving"
40 | style=filled
41 | fillcolor=gray95
42 |
43 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
44 |
45 | c2 [label="{contacts:null|}", fillcolor=1]
46 | c3 [label="{array|}", fillcolor=4]
47 | c21 [label="{|}"]
48 | c22 [label="{|}"]
49 | c23 [shape="none", label="...", style="solid"]
50 | o2 [label="{o:object|}", fillcolor=3]
51 | cs [label="{string|\"contacts\"}", fillcolor=5]
52 | c2 -> o2 [style="dashed", constraint=false, label="AddMember", style=invis]
53 |
54 | edge [arrowhead=vee]
55 | c3 -> { c21; c22; c23 }
56 | o2 -> cs
57 | cs -> c3 [arrowhead=none]
58 | }
59 | ghost -> o2 [style=invis]
60 | }
61 |
--------------------------------------------------------------------------------
/doc/diagram/move3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/move3.png
--------------------------------------------------------------------------------
/doc/diagram/normalparsing.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
11 |
12 | {
13 | node [shape=record, fontsize="8", margin="0.04", height=0.2, color=gray]
14 | normaljson [label="\{|\"|m|s|g|\"|:|\"|H|e|l|l|o|\\|n|W|o|r|l|d|!|\"|,|\"|\\|u|0|0|7|3|t|a|r|s\"|:|1|0|\}"]
15 |
16 | {
17 | rank = same
18 | msgstring [label="m|s|g|\\0"]
19 | helloworldstring [label="H|e|l|l|o|\\n|W|o|r|l|d|!|\\0"]
20 | starsstring [label="s|t|a|r|s\\0"]
21 | }
22 | }
23 |
24 | subgraph cluster1 {
25 | margin="10,10"
26 | labeljust="left"
27 | label = "Document by Normal Parsing"
28 | style=filled
29 | fillcolor=gray95
30 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
31 |
32 | root [label="{object|}", fillcolor=3]
33 |
34 | {
35 | msg [label="{string|}", fillcolor=5]
36 | helloworld [label="{string|}", fillcolor=5]
37 | stars [label="{string|}", fillcolor=5]
38 | ten [label="{number|10}", fillcolor=6]
39 | }
40 | }
41 |
42 | normaljson -> root [label=" Parse()" lhead="cluster1"]
43 | edge [arrowhead=vee]
44 | root -> { msg; stars }
45 |
46 | edge [arrowhead="none"]
47 | msg -> helloworld
48 | stars -> ten
49 |
50 | edge [arrowhead=vee, arrowtail=dot, arrowsize=0.5, dir=both, tailclip=false]
51 | msg:a:c -> msgstring:w
52 | helloworld:a:c -> helloworldstring:w
53 | stars:a:c -> starsstring:w
54 |
55 | msgstring -> helloworldstring -> starsstring [style=invis]
56 | }
--------------------------------------------------------------------------------
/doc/diagram/normalparsing.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/normalparsing.png
--------------------------------------------------------------------------------
/doc/diagram/simpledom.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10, arrowhead=normal]
11 |
12 | {
13 | node [shape=record, fontsize="8", margin="0.04", height=0.2, color=gray]
14 | srcjson [label="\{|\"|p|r|o|j|e|c|t|\"|:|\"|r|a|p|i|d|j|s|o|n|\"|,|\"|s|t|a|r|s|\"|:|1|0|\}"]
15 | dstjson [label="\{|\"|p|r|o|j|e|c|t|\"|:|\"|r|a|p|i|d|j|s|o|n|\"|,|\"|s|t|a|r|s|\"|:|1|1|\}"]
16 | }
17 |
18 | {
19 | node [shape="box", style="filled", fillcolor="gray95"]
20 | Document2 [label="(Modified) Document"]
21 | Writer
22 | }
23 |
24 | subgraph cluster1 {
25 | margin="10,10"
26 | labeljust="left"
27 | label = "Document"
28 | style=filled
29 | fillcolor=gray95
30 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
31 |
32 | root [label="{object|}", fillcolor=3]
33 |
34 | {
35 | project [label="{string|\"project\"}", fillcolor=5]
36 | rapidjson [label="{string|\"rapidjson\"}", fillcolor=5]
37 | stars [label="{string|\"stars\"}", fillcolor=5]
38 | ten [label="{number|10}", fillcolor=6]
39 | }
40 |
41 | edge [arrowhead=vee]
42 | root -> { project; stars }
43 |
44 | edge [arrowhead="none"]
45 | project -> rapidjson
46 | stars -> ten
47 | }
48 |
49 | srcjson -> root [label=" Parse()", lhead="cluster1"]
50 |
51 | ten -> Document2 [label=" Increase \"stars\"", ltail="cluster1" ]
52 | Document2 -> Writer [label=" Traverse DOM by Accept()"]
53 | Writer -> dstjson [label=" Output to StringBuffer"]
54 | }
--------------------------------------------------------------------------------
/doc/diagram/simpledom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/simpledom.png
--------------------------------------------------------------------------------
/doc/diagram/tutorial.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | compound=true
3 | fontname="Inconsolata, Consolas"
4 | fontsize=10
5 | margin="0,0"
6 | ranksep=0.2
7 | penwidth=0.5
8 |
9 | node [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
10 | edge [fontname="Inconsolata, Consolas", fontsize=10]
11 |
12 | subgraph cluster1 {
13 | margin="10,10"
14 | labeljust="left"
15 | label = "Document"
16 | style=filled
17 | fillcolor=gray95
18 | node [shape=Mrecord, style=filled, colorscheme=spectral7]
19 |
20 | root [label="{object|}", fillcolor=3]
21 |
22 | {
23 | hello [label="{string|\"hello\"}", fillcolor=5]
24 | t [label="{string|\"t\"}", fillcolor=5]
25 | f [label="{string|\"f\"}", fillcolor=5]
26 | n [label="{string|\"n\"}", fillcolor=5]
27 | i [label="{string|\"i\"}", fillcolor=5]
28 | pi [label="{string|\"pi\"}", fillcolor=5]
29 | a [label="{string|\"a\"}", fillcolor=5]
30 |
31 | world [label="{string|\"world\"}", fillcolor=5]
32 | true [label="{true|}", fillcolor=7]
33 | false [label="{false|}", fillcolor=2]
34 | null [label="{null|}", fillcolor=1]
35 | i1 [label="{number|123}", fillcolor=6]
36 | pi1 [label="{number|3.1416}", fillcolor=6]
37 | array [label="{array|size=4}", fillcolor=4]
38 |
39 | a1 [label="{number|1}", fillcolor=6]
40 | a2 [label="{number|2}", fillcolor=6]
41 | a3 [label="{number|3}", fillcolor=6]
42 | a4 [label="{number|4}", fillcolor=6]
43 | }
44 |
45 | edge [arrowhead=vee]
46 | root -> { hello; t; f; n; i; pi; a }
47 | array -> { a1; a2; a3; a4 }
48 |
49 | edge [arrowhead=none]
50 | hello -> world
51 | t -> true
52 | f -> false
53 | n -> null
54 | i -> i1
55 | pi -> pi1
56 | a -> array
57 | }
58 | }
--------------------------------------------------------------------------------
/doc/diagram/tutorial.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/tutorial.png
--------------------------------------------------------------------------------
/doc/diagram/utilityclass.dot:
--------------------------------------------------------------------------------
1 | digraph {
2 | rankdir=LR
3 | compound=true
4 | fontname="Inconsolata, Consolas"
5 | fontsize=10
6 | margin="0,0"
7 | ranksep=0.3
8 | nodesep=0.15
9 | penwidth=0.5
10 | colorscheme=spectral7
11 |
12 | node [shape=box, fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5, style=filled, fillcolor=white]
13 | edge [fontname="Inconsolata, Consolas", fontsize=10, penwidth=0.5]
14 |
15 | subgraph cluster0 {
16 | style=filled
17 | fillcolor=4
18 |
19 | Encoding [label="<>\nEncoding"]
20 |
21 | edge [arrowtail=onormal, dir=back]
22 | Encoding -> { UTF8; UTF16; UTF32; ASCII; AutoUTF }
23 | UTF16 -> { UTF16LE; UTF16BE }
24 | UTF32 -> { UTF32LE; UTF32BE }
25 | }
26 |
27 | subgraph cluster1 {
28 | style=filled
29 | fillcolor=5
30 |
31 | Stream [label="<>\nStream"]
32 | InputByteStream [label="<>\nInputByteStream"]
33 | OutputByteStream [label="<>\nOutputByteStream"]
34 |
35 | edge [arrowtail=onormal, dir=back]
36 | Stream -> {
37 | StringStream; InsituStringStream; StringBuffer;
38 | EncodedInputStream; EncodedOutputStream;
39 | AutoUTFInputStream; AutoUTFOutputStream
40 | InputByteStream; OutputByteStream
41 | }
42 |
43 | InputByteStream -> { MemoryStream; FlieReadStream }
44 | OutputByteStream -> { MemoryBuffer; FileWriteStream }
45 | }
46 |
47 | subgraph cluster2 {
48 | style=filled
49 | fillcolor=3
50 |
51 | Allocator [label="<>\nAllocator"]
52 |
53 | edge [arrowtail=onormal, dir=back]
54 | Allocator -> { CrtAllocator; MemoryPoolAllocator }
55 | }
56 |
57 | {
58 | edge [arrowtail=odiamond, arrowhead=vee, dir=both]
59 | EncodedInputStream -> InputByteStream
60 | EncodedOutputStream -> OutputByteStream
61 | AutoUTFInputStream -> InputByteStream
62 | AutoUTFOutputStream -> OutputByteStream
63 | MemoryPoolAllocator -> Allocator [label="base", tailport=s]
64 | }
65 |
66 | {
67 | edge [arrowhead=vee, style=dashed]
68 | AutoUTFInputStream -> AutoUTF
69 | AutoUTFOutputStream -> AutoUTF
70 | }
71 |
72 | //UTF32LE -> Stream [style=invis]
73 | }
--------------------------------------------------------------------------------
/doc/diagram/utilityclass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/diagram/utilityclass.png
--------------------------------------------------------------------------------
/doc/features.zh-cn.md:
--------------------------------------------------------------------------------
1 | # 特点
2 |
3 | ## 总体
4 |
5 | * 跨平台
6 | * 编译器:Visual Studio、gcc、clang 等
7 | * 架构:x86、x64、ARM 等
8 | * 操作系统:Windows、Mac OS X、Linux、iOS、Android 等
9 | * 容易安装
10 | * 只有头文件的库。只需把头文件复制至你的项目中。
11 | * 独立、最小依赖
12 | * 不需依赖 STL、BOOST 等。
13 | * 只包含 ``, ``, ``, ``, ``, ``。
14 | * 没使用 C++ 异常、RTTI
15 | * 高性能
16 | * 使用模版及内联函数去降低函数调用开销。
17 | * 内部经优化的 Grisu2 及浮点数解析实现。
18 | * 可选的 SSE2/SSE4.2 支持。
19 |
20 | ## 符合标准
21 |
22 | * RapidJSON 应完全符合 RFC4627/ECMA-404 标准。
23 | * 支持 JSON Pointer (RFC6901).
24 | * 支持 JSON Schema Draft v4.
25 | * 支持 Unicode 代理对(surrogate pair)。
26 | * 支持空字符(`"\u0000"`)。
27 | * 例如,可以优雅地解析及处理 `["Hello\u0000World"]`。含读写字符串长度的 API。
28 | * 支持可选的放宽语法
29 | * 单行(`// ...`)及多行(`/* ... */`) 注释 (`kParseCommentsFlag`)。
30 | * 在对象和数组结束前含逗号 (`kParseTrailingCommasFlag`)。
31 | * `NaN`、`Inf`、`Infinity`、`-Inf` 及 `-Infinity` 作为 `double` 值 (`kParseNanAndInfFlag`)
32 | * [NPM 兼容](https://github.com/Tencent/rapidjson/blob/master/doc/npm.md).
33 |
34 | ## Unicode
35 |
36 | * 支持 UTF-8、UTF-16、UTF-32 编码,包括小端序和大端序。
37 | * 这些编码用于输入输出流,以及内存中的表示。
38 | * 支持从输入流自动检测编码。
39 | * 内部支持编码的转换。
40 | * 例如,你可以读取一个 UTF-8 文件,让 RapidJSON 把 JSON 字符串转换至 UTF-16 的 DOM。
41 | * 内部支持编码校验。
42 | * 例如,你可以读取一个 UTF-8 文件,让 RapidJSON 检查是否所有 JSON 字符串是合法的 UTF-8 字节序列。
43 | * 支持自定义的字符类型。
44 | * 预设的字符类型是:UTF-8 为 `char`,UTF-16 为 `wchar_t`,UTF32 为 `uint32_t`。
45 | * 支持自定义的编码。
46 |
47 | ## API 风格
48 |
49 | * SAX(Simple API for XML)风格 API
50 | * 类似于 [SAX](http://en.wikipedia.org/wiki/Simple_API_for_XML), RapidJSON 提供一个事件循序访问的解析器 API(`rapidjson::GenericReader`)。RapidJSON 也提供一个生成器 API(`rapidjson::Writer`),可以处理相同的事件集合。
51 | * DOM(Document Object Model)风格 API
52 | * 类似于 HTML/XML 的 [DOM](http://en.wikipedia.org/wiki/Document_Object_Model),RapidJSON 可把 JSON 解析至一个 DOM 表示方式(`rapidjson::GenericDocument`),以方便操作。如有需要,可把 DOM 转换(stringify)回 JSON。
53 | * DOM 风格 API(`rapidjson::GenericDocument`)实际上是由 SAX 风格 API(`rapidjson::GenericReader`)实现的。SAX 更快,但有时 DOM 更易用。用户可根据情况作出选择。
54 |
55 | ## 解析
56 |
57 | * 递归式(预设)及迭代式解析器
58 | * 递归式解析器较快,但在极端情况下可出现堆栈溢出。
59 | * 迭代式解析器使用自定义的堆栈去维持解析状态。
60 | * 支持原位(*in situ*)解析。
61 | * 把 JSON 字符串的值解析至原 JSON 之中,然后让 DOM 指向那些字符串。
62 | * 比常规分析更快:不需字符串的内存分配、不需复制(如字符串不含转义符)、缓存友好。
63 | * 对于 JSON 数字类型,支持 32-bit/64-bit 的有号/无号整数,以及 `double`。
64 | * 错误处理
65 | * 支持详尽的解析错误代号。
66 | * 支持本地化错误信息。
67 |
68 | ## DOM (Document)
69 |
70 | * RapidJSON 在类型转换时会检查数值的范围。
71 | * 字符串字面量的优化
72 | * 只储存指针,不作复制
73 | * 优化“短”字符串
74 | * 在 `Value` 内储存短字符串,无需额外分配。
75 | * 对 UTF-8 字符串来说,32 位架构下可存储最多 11 字符,64 位下 21 字符(x86-64 下 13 字符)。
76 | * 可选地支持 `std::string`(定义 `RAPIDJSON_HAS_STDSTRING=1`)
77 |
78 | ## 生成
79 |
80 | * 支持 `rapidjson::PrettyWriter` 去加入换行及缩进。
81 |
82 | ## 输入输出流
83 |
84 | * 支持 `rapidjson::GenericStringBuffer`,把输出的 JSON 储存于字符串内。
85 | * 支持 `rapidjson::FileReadStream` 及 `rapidjson::FileWriteStream`,使用 `FILE` 对象作输入输出。
86 | * 支持自定义输入输出流。
87 |
88 | ## 内存
89 |
90 | * 最小化 DOM 的内存开销。
91 | * 对大部分 32/64 位机器而言,每个 JSON 值只占 16 或 20 字节(不包含字符串)。
92 | * 支持快速的预设分配器。
93 | * 它是一个堆栈形式的分配器(顺序分配,不容许单独释放,适合解析过程之用)。
94 | * 使用者也可提供一个预分配的缓冲区。(有可能达至无需 CRT 分配就能解析多个 JSON)
95 | * 支持标准 CRT(C-runtime)分配器。
96 | * 支持自定义分配器。
97 |
98 | ## 其他
99 |
100 | * 一些 C++11 的支持(可选)
101 | * 右值引用(rvalue reference)
102 | * `noexcept` 修饰符
103 | * 范围 for 循环
104 |
--------------------------------------------------------------------------------
/doc/logo/rapidjson.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tencent/rapidjson/24b5e7a8b27f42fa16b96fc70aade9106cf7102f/doc/logo/rapidjson.png
--------------------------------------------------------------------------------
/doc/misc/footer.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |