RE: [Testdev] [model-test] referencing external schema

Yes. I actually had created the definitions folder before I realized relative addressing wasn't working.  I'm in the process of creating some better examples of re-useable definitions – the samples I included in my email are out of date and will be replaced. 
Tim Cole
From: Testdev [] On Behalf Of Benjamin Young
Sent: Wednesday, June 08, 2016 2:26 PM
To: Discussions about Test Development <>
Cc: W3C Public Annotation List <>
Subject: Re: [Testdev] [model-test] referencing external schema
Hey Tim,
Sorry for the wait. Shane and I just chatted about this $ref thing and I think we can make it work in WPT. It’s mostly a question of what the relative path expectations of `ajv` tucked inside of WPT might be.
It looks like we may also be able to hack around the defaults (if need be) using wptserve’s Pipes system:
What we’re thinking right now is taking the JSON objects you now have in the `definitions` object (which you pasted below) and putting those inside of a `definitions` folder and then working through the relative path details with WPT.
Would that serve as a solution for what you’re attempting here?
From: Testdev [] On Behalf Of Shane McCarron
Sent: Wednesday, June 8, 2016 10:46 AM
To: Discussions about Test Development < <> >
Cc: W3C Public Annotation List < <> >
Subject: Re: [Testdev] [model-test] referencing external schema
Did you get any traction on this Tim?  
On Thu, Jun 2, 2016 at 10:19 AM, Timothy Cole < <> > wrote:
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 <>  (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. 
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"]

Testdev mailing list <> <> 

Shane McCarron
Projects Manager, Spec-Ops

Received on Wednesday, 8 June 2016 19:51:32 UTC