-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the use of $ref in the JSON being validated supported? #24
Comments
So if you are trying to use |
Thanks Nate, I figured that might be the case. Is that a specific implementation choice you have made in JaySchema, or As always, I am very appreciative of the prompt responses you provide. Regards On Tue, Feb 4, 2014 at 4:08 AM, Nate Silva [email protected] wrote:
|
JSON-Ref and JSON Pointer were created by some of the same folks who created JSON Schema. I believe they were created for use in schemas, but you’re right, there’s nothing limiting it to that. I don’t know if other validators allow you to have a |
Thanks Nate. My use-case naturally lent itself to $ref in the schema AND in the instance. Basically it is a situation where you want to aggregate existing objects which already have their own schemas, and validate the aggregation as a whole. Any chance of adding $ref for instances to your feature wish list? Thanks Michael From: Nate Silva [mailto:[email protected]] JSON-Ref and [JSON Pointer])[http://tools.ietf.org/html/rfc6901] were created by some of the same folks who created JSON Schema. I believe they were created for use in schemas, but you’re right, there’s nothing limiting it to that. I don’t know if other validators allow you to have a $ref in your instance data. I believe most, if all, do not. It would be an interesting feature though. — |
I posted this question to a closed issue accidently so not sure if anyone saw it. I am using $ref to pull in multiple values into the JSON being validated.
I wanted to confirm if Jayschema supports the use of $ref in the input to be validated. The errors I am getting would suggest it doesn't or more likely, I've not got the code quite right.
The data file looks like this
{
"Profile":{
"Type":"ebMS3_PModeOperationSet",
"Purpose":"Positive",
"Title":"PMode Operation Set for Superstream Entry Level",
"Description":"Covers ultra-light and light profiles",
"Version":{
"Major":0,
"Minor":1
}
},
"PModes" : [
{"$ref" : "http://test.compliancetest.net/get-profile?id=e7359f244623457286c672a4c1e7ae7dc8eb405b"},
{"$ref" : "http://test.compliancetest.net/get-profile?id=1f1c6bb0c31a2a5f78fc4757ad20f39e242b16ff"},
{"$ref" : "http://test.compliancetest.net/get-profile?id=92befc2c857eef0d0d912901dfedaa11e4269afe"}
]
}
and the schema looks like this
{
"$schema" : "http://json-schema.org/draft-04/schema#",
"title" : "ebMS3 PMode Operation Set Profile",
"Version" : {
"Major" : 0,
"Minor" : 1
},
"type" : "object",
"properties" : {
"Profile" : {"$ref" : "#/definitions/Profile/Profile"},
"PModes" : {"$ref" : "#/definitions/PMode/OperationSet"}
},
"required" : ["Profile", "PModes"],
"definitions" : {
"Types" : {
"NonNegativeInteger" : {"type" : "integer", "minimum" : 0},
}
}
the errors I am getting are
[ { instanceContext: '#/PModes/0',
resolutionScope: 'https://test.compliancetest.net/?download_profile_type=1&type_id=26#',
constraintName: 'required',
constraintValue: [ 'Profile', 'General' ],
desc: 'missing: Profile,General',
kind: 'ObjectValidationError' },
{ instanceContext: '#/PModes/1',
resolutionScope: 'https://test.compliancetest.net/?download_profile_type=1&type_id=26#',
constraintName: 'required',
constraintValue: [ 'Profile', 'General' ],
desc: 'missing: Profile,General',
kind: 'ObjectValidationError' },
{ instanceContext: '#/PModes/2',
resolutionScope: 'https://test.compliancetest.net/?download_profile_type=1&type_id=26#',
constraintName: 'required',
constraintValue: [ 'Profile', 'General' ],
desc: 'missing: Profile,General',
kind: 'ObjectValidationError' } ]
Is there a way to see what the schema validator thinks is the effective JSON it is validating? I'm thinking my data includes aren't right for some reason.
Thanks for your assistance.
Regards
Michael
The text was updated successfully, but these errors were encountered: