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
9c0e409f
Commit
9c0e409f
authored
May 07, 2015
by
miloyip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix "additional items do not match schema"
parent
f19a1b6a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
schema.h
include/rapidjson/schema.h
+21
-11
No files found.
include/rapidjson/schema.h
View file @
9c0e409f
...
@@ -123,7 +123,7 @@ public:
...
@@ -123,7 +123,7 @@ public:
not_
(),
not_
(),
type_
((
1
<<
kTotalSchemaType
)
-
1
),
// typeless
type_
((
1
<<
kTotalSchemaType
)
-
1
),
// typeless
properties_
(),
properties_
(),
additionalPropert
y
Schema_
(),
additionalPropert
ies
Schema_
(),
#if RAPIDJSON_SCHEMA_HAS_REGEX
#if RAPIDJSON_SCHEMA_HAS_REGEX
patternProperties_
(),
patternProperties_
(),
patternPropertyCount_
(),
patternPropertyCount_
(),
...
@@ -132,8 +132,9 @@ public:
...
@@ -132,8 +132,9 @@ public:
requiredCount_
(),
requiredCount_
(),
minProperties_
(),
minProperties_
(),
maxProperties_
(
SizeType
(
~
0
)),
maxProperties_
(
SizeType
(
~
0
)),
additionalPropert
y
_
(
true
),
additionalPropert
ies
_
(
true
),
hasDependencies_
(),
hasDependencies_
(),
additionalItemsSchema_
(),
itemsList_
(),
itemsList_
(),
itemsTuple_
(),
itemsTuple_
(),
itemsTupleCount_
(),
itemsTupleCount_
(),
...
@@ -238,9 +239,9 @@ public:
...
@@ -238,9 +239,9 @@ public:
if
(
const
ValueType
*
v
=
GetMember
(
value
,
"additionalProperties"
))
{
if
(
const
ValueType
*
v
=
GetMember
(
value
,
"additionalProperties"
))
{
if
(
v
->
IsBool
())
if
(
v
->
IsBool
())
additionalPropert
y
_
=
v
->
GetBool
();
additionalPropert
ies
_
=
v
->
GetBool
();
else
if
(
v
->
IsObject
())
else
if
(
v
->
IsObject
())
additionalPropert
y
Schema_
=
new
BaseSchema
<
Encoding
>
(
*
v
);
additionalPropert
ies
Schema_
=
new
BaseSchema
<
Encoding
>
(
*
v
);
}
}
AssignIfExist
(
minProperties_
,
value
,
"minProperties"
);
AssignIfExist
(
minProperties_
,
value
,
"minProperties"
);
...
@@ -259,7 +260,13 @@ public:
...
@@ -259,7 +260,13 @@ public:
AssignIfExist
(
minItems_
,
value
,
"minItems"
);
AssignIfExist
(
minItems_
,
value
,
"minItems"
);
AssignIfExist
(
maxItems_
,
value
,
"maxItems"
);
AssignIfExist
(
maxItems_
,
value
,
"maxItems"
);
AssignIfExist
(
additionalItems_
,
value
,
"additionalItems"
);
if
(
const
ValueType
*
v
=
GetMember
(
value
,
"additionalItems"
))
{
if
(
v
->
IsBool
())
additionalItems_
=
v
->
GetBool
();
else
if
(
v
->
IsObject
())
additionalItemsSchema_
=
new
BaseSchema
<
Encoding
>
(
*
v
);
}
// String
// String
AssignIfExist
(
minLength_
,
value
,
"minLength"
);
AssignIfExist
(
minLength_
,
value
,
"minLength"
);
...
@@ -296,7 +303,7 @@ public:
...
@@ -296,7 +303,7 @@ public:
~
BaseSchema
()
{
~
BaseSchema
()
{
delete
not_
;
delete
not_
;
delete
[]
properties_
;
delete
[]
properties_
;
delete
additionalPropert
y
Schema_
;
delete
additionalPropert
ies
Schema_
;
#if RAPIDJSON_SCHEMA_HAS_REGEX
#if RAPIDJSON_SCHEMA_HAS_REGEX
delete
[]
patternProperties_
;
delete
[]
patternProperties_
;
#endif
#endif
...
@@ -316,6 +323,8 @@ public:
...
@@ -316,6 +323,8 @@ public:
else
if
(
itemsTuple_
)
{
else
if
(
itemsTuple_
)
{
if
(
context
.
arrayElementIndex
<
itemsTupleCount_
)
if
(
context
.
arrayElementIndex
<
itemsTupleCount_
)
context
.
valueSchema
=
itemsTuple_
[
context
.
arrayElementIndex
];
context
.
valueSchema
=
itemsTuple_
[
context
.
arrayElementIndex
];
else
if
(
additionalItemsSchema_
)
context
.
valueSchema
=
additionalItemsSchema_
;
else
if
(
additionalItems_
)
else
if
(
additionalItems_
)
context
.
valueSchema
=
GetTypeless
();
context
.
valueSchema
=
GetTypeless
();
else
else
...
@@ -470,11 +479,11 @@ public:
...
@@ -470,11 +479,11 @@ public:
}
}
#endif
#endif
if
(
additionalPropert
y
Schema_
)
{
if
(
additionalPropert
ies
Schema_
)
{
context
.
valueSchema
=
additionalPropert
y
Schema_
;
context
.
valueSchema
=
additionalPropert
ies
Schema_
;
return
true
;
return
true
;
}
}
else
if
(
additionalPropert
y
_
)
{
else
if
(
additionalPropert
ies
_
)
{
context
.
valueSchema
=
GetTypeless
();
context
.
valueSchema
=
GetTypeless
();
return
true
;
return
true
;
}
}
...
@@ -674,7 +683,7 @@ private:
...
@@ -674,7 +683,7 @@ private:
unsigned
type_
;
// bitmask of kSchemaType
unsigned
type_
;
// bitmask of kSchemaType
Property
*
properties_
;
Property
*
properties_
;
BaseSchema
<
Encoding
>*
additionalPropert
y
Schema_
;
BaseSchema
<
Encoding
>*
additionalPropert
ies
Schema_
;
#if RAPIDJSON_SCHEMA_HAS_REGEX
#if RAPIDJSON_SCHEMA_HAS_REGEX
PatternProperty
*
patternProperties_
;
PatternProperty
*
patternProperties_
;
SizeType
patternPropertyCount_
;
SizeType
patternPropertyCount_
;
...
@@ -683,9 +692,10 @@ private:
...
@@ -683,9 +692,10 @@ private:
SizeType
requiredCount_
;
SizeType
requiredCount_
;
SizeType
minProperties_
;
SizeType
minProperties_
;
SizeType
maxProperties_
;
SizeType
maxProperties_
;
bool
additionalPropert
y
_
;
bool
additionalPropert
ies
_
;
bool
hasDependencies_
;
bool
hasDependencies_
;
BaseSchema
<
Encoding
>*
additionalItemsSchema_
;
BaseSchema
<
Encoding
>*
itemsList_
;
BaseSchema
<
Encoding
>*
itemsList_
;
BaseSchema
<
Encoding
>**
itemsTuple_
;
BaseSchema
<
Encoding
>**
itemsTuple_
;
SizeType
itemsTupleCount_
;
SizeType
itemsTupleCount_
;
...
...
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