- From: Timothy Cole <t-cole3@illinois.edu>
- Date: Thu, 2 Jun 2016 10:19:00 -0500
- To: "'W3C Public Annotation List'" <public-annotation@w3.org>, <testdev@lists.spec-ops.io>
- Message-ID: <0de301d1bce2$1b5a2b60$520e8220$@illinois.edu>
We are currently developing json schemas to help test for implementations of
SpecificResource features of the data model. I've uploaded 4 of the schemas
currently being developed to
https://github.com/w3c/web-annotation-tests/tree/master/SpecificResource
(these are first drafts, not quite ready, still being debugged and refined).
All 4 schemas share a definitions section containing 2 sub-schemas (appended
below). These are easy to reference internally where needed, but it would
be even more convenient to reference them as external schemas. This should
be possible using $ref, but I've had difficulties getting this approach to
work with my local ajv instance, especially with regard to relative file
locations.
Is anyone familiar enough with how $ref works within the Web Platform
Testing framework's implementation of ajv to advise?
Below is the current way the sub-schemas are embedded in each primary
schema. Obviously this works, but it means repeating the same sub-schemas in
multiple files, which is obviously less efficient than if these sub-schemas
could be referenced as individual files.
Thanks,
Tim Cole
{
"definitions": {
"SpecificResource": {
"type": "object",
"properties": {
"selector": {},
"state": {},
"styleClass": {},
"renderedVia": {},
"scope": {},
"purpose": {}
},
"anyOf": [
{"required": ["selector"]},
{"required": ["state"]},
{"required": ["styleClass"]},
{"required": ["renderedVia"]},
{"required": ["scope"]},
{
"required": ["purpose"],
"not": {"required": ["value"]}
}
]
},
"SpecificResType" : {
"type": "object",
"properties": {
"type": {
"oneOf": [
{"type": "string",
"enum": ["SpecificResource"]},
{"type": "array",
"items": [{ "type": "string",
"enum": ["SpecificResource"] }]
} ]
}
},
"required": ["type"]
}
}
}
Received on Thursday, 2 June 2016 15:19:54 UTC