Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
5b6061c7
Commit
5b6061c7
authored
May 16, 2015
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix meta schema validation
parent
11f666a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
schema.h
include/rapidjson/schema.h
+4
-5
schematest.cpp
test/unittest/schematest.cpp
+3
-3
No files found.
include/rapidjson/schema.h
View file @
5b6061c7
...
...
@@ -60,11 +60,11 @@ RAPIDJSON_MULTILINEMACRO_END
#endif
#define RAPIDJSON_INVALID_KEYWORD_RETURN(keyword)\
RAPIDJSON_MULTILINEMACRO_BEGIN\
RAPIDJSON_MULTILINEMACRO_BEGIN\
context.invalidKeyword = keyword;\
RAPIDJSON_INVALID_KEYWORD_VERBOSE(keyword);\
return false;\
RAPIDJSON_MULTILINEMACRO_END
RAPIDJSON_MULTILINEMACRO_END
RAPIDJSON_NAMESPACE_BEGIN
...
...
@@ -460,10 +460,10 @@ public:
// Array
if
(
const
ValueType
*
v
=
GetMember
(
value
,
"items"
))
{
PointerType
q
=
p
.
Append
(
"items"
);
if
(
v
->
IsObject
())
// List validation
document
->
CreateSchema
(
&
itemsList_
,
p
,
*
v
);
document
->
CreateSchema
(
&
itemsList_
,
q
,
*
v
);
else
if
(
v
->
IsArray
())
{
// Tuple validation
PointerType
q
=
p
.
Append
(
"items"
);
itemsTuple_
=
static_cast
<
const
Schema
**>
(
allocator_
->
Malloc
(
sizeof
(
const
Schema
*
)
*
v
->
Size
()));
SizeType
index
=
0
;
for
(
ConstValueIterator
itr
=
v
->
Begin
();
itr
!=
v
->
End
();
++
itr
,
index
++
)
...
...
@@ -1126,7 +1126,6 @@ private:
SValue
minimum_
;
SValue
maximum_
;
SValue
multipleOf_
;
bool
hasMultipleOf_
;
bool
exclusiveMinimum_
;
bool
exclusiveMaximum_
;
};
...
...
test/unittest/schematest.cpp
View file @
5b6061c7
...
...
@@ -659,7 +659,7 @@ TEST(SchemaValidator, Array_ItemsList) {
SchemaDocument
s
(
sd
);
VALIDATE
(
s
,
"[1, 2, 3, 4, 5]"
,
true
);
INVALIDATE
(
s
,
"[1, 2,
\"
3
\"
, 4, 5]"
,
""
,
"type"
,
"/2"
);
INVALIDATE
(
s
,
"[1, 2,
\"
3
\"
, 4, 5]"
,
"
/items
"
,
"type"
,
"/2"
);
VALIDATE
(
s
,
"[]"
,
true
);
}
...
...
@@ -776,8 +776,8 @@ TEST(SchemaValidator, ObjectInArray) {
SchemaDocument
s
(
sd
);
VALIDATE
(
s
,
"[
\"
a
\"
]"
,
true
);
INVALIDATE
(
s
,
"[1]"
,
""
,
"type"
,
"/0"
);
INVALIDATE
(
s
,
"[{}]"
,
""
,
"type"
,
"/0"
);
INVALIDATE
(
s
,
"[1]"
,
"
/items
"
,
"type"
,
"/0"
);
INVALIDATE
(
s
,
"[{}]"
,
"
/items
"
,
"type"
,
"/0"
);
}
TEST
(
SchemaValidator
,
MultiTypeInObject
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment