learningtapestry / metadataregistry

DEPRECATED - THIS CODE BASE IS NO LONGER MAINTAINED. Metadata Registry
Apache License 2.0
7 stars 5 forks source link

How to associate a third party controlled vocabulary with our labels in json-schema? #22

Closed science closed 8 years ago

science commented 8 years ago

In my call yesterday with CTI, the question was raised by @stuartasutton as to how we can provide linked data references to remote controlled vocabularies in our json-schema validation system.

For example, right now we have agentCategory defined as:

agentCategory: [labels,...]

I think those labels have actually been defined at some remote URL already. So it would be great if we could provide a URL reference to that. The simplest way seemed to be using the "description" field to provide that information.

Stuart thought there might be a more formal method to making the association in a way that was machine-readable?

My only concern was that if we just provided a URL to the labels, then programmers have to hop around between different schema files to figure out what's permissible, and that makes their jobs harder..

Thoughts? Ideas?

andersoncardoso commented 8 years ago

Normally we use the $ref property to define a external reference, or to 'dry' our schemas.

Example:

// some-schema.json
"definitions": {
  "agentCategory": {
     "type": "string",
     "enum": [ .... ]
   }
}

// other-schema.json
"myfield": { "$ref": "some-schema.json#definitions/agentCategory" }

but there is this caveat of having to jump on differente schemas. We can:

I did a proof-of-concept with the erb templates already, but did not used at the end (can easily rebuild it).

andersoncardoso commented 8 years ago

On the PR above we added an engine for loading schemas from composable ERB templates. I.e, we can add embeded definitions or resolve ref dinamically.

We refactored all the current schemas to use this new engine.

Using this we could reuse, partially, the definitions we generated on https://github.com/learningtapestry/json-schema.org

I'll close this for now, but if something new comes up we might reopen/rediscuss.