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
8022a5f7
Unverified
Commit
8022a5f7
authored
Mar 27, 2018
by
Milo Yip
Committed by
GitHub
Mar 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1210 from foxtacles/fix-missing-remote-ref-p
add remote ref pointer to schemaMap_
parents
67a17cfd
9640209f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
schema.h
include/rapidjson/schema.h
+1
-0
schematest.cpp
test/unittest/schematest.cpp
+29
-0
No files found.
include/rapidjson/schema.h
View file @
8022a5f7
...
...
@@ -1673,6 +1673,7 @@ private:
if
(
const
SchemaType
*
sc
=
remoteDocument
->
GetSchema
(
pointer
))
{
if
(
schema
)
*
schema
=
sc
;
new
(
schemaMap_
.
template
Push
<
SchemaEntry
>
())
SchemaEntry
(
source
,
const_cast
<
SchemaType
*>
(
sc
),
false
,
allocator_
);
return
true
;
}
}
...
...
test/unittest/schematest.cpp
View file @
8022a5f7
...
...
@@ -2004,6 +2004,35 @@ TEST(SchemaValidator, Ref_remote) {
SchemaValidatorType
,
PointerType
);
}
TEST
(
SchemaValidator
,
Ref_remote_issue1210
)
{
class
SchemaDocumentProvider
:
public
IRemoteSchemaDocumentProvider
{
SchemaDocument
**
collection
;
public
:
SchemaDocumentProvider
(
SchemaDocument
**
collection
)
:
collection
(
collection
)
{
}
virtual
const
SchemaDocument
*
GetRemoteDocument
(
const
char
*
uri
,
SizeType
length
)
{
int
i
=
0
;
while
(
collection
[
i
]
&&
SchemaDocument
::
URIType
(
uri
,
length
)
!=
collection
[
i
]
->
GetURI
())
++
i
;
return
collection
[
i
];
}
};
SchemaDocument
*
collection
[]
=
{
0
,
0
,
0
};
SchemaDocumentProvider
provider
(
collection
);
Document
x
,
y
,
z
;
x
.
Parse
(
"{
\"
properties
\"
:{
\"
country
\"
:{
\"
$ref
\"
:
\"
y.json#/definitions/country_remote
\"
}},
\"
type
\"
:
\"
object
\"
}"
);
y
.
Parse
(
"{
\"
definitions
\"
:{
\"
country_remote
\"
:{
\"
$ref
\"
:
\"
z.json#/definitions/country_list
\"
}}}"
);
z
.
Parse
(
"{
\"
definitions
\"
:{
\"
country_list
\"
:{
\"
enum
\"
:[
\"
US
\"
]}}}"
);
SchemaDocument
sz
(
z
,
"z.json"
,
6
,
&
provider
);
collection
[
0
]
=
&
sz
;
SchemaDocument
sy
(
y
,
"y.json"
,
6
,
&
provider
);
collection
[
1
]
=
&
sy
;
SchemaDocument
sx
(
x
,
"x.json"
,
6
,
&
provider
);
VALIDATE
(
sx
,
"{
\"
country
\"
:
\"
UK
\"
}"
,
false
);
VALIDATE
(
sx
,
"{
\"
country
\"
:
\"
US
\"
}"
,
true
);
}
#ifdef __clang__
RAPIDJSON_DIAG_POP
#endif
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