Closed RangerMauve closed 9 years ago
That is an interesting idea; thanks for the suggestion.
My concern with this is with maintenance of the schema file. I would rather see projects resolve the schema using the canonical URL: http://jsongraphformat.info/schema.json
Would this be a solution for you?
On a related note, it would be pretty cool to provide a thin javascript API to validate JGF using tv4. Furthermore we could parse JGF to a graph data structure for easier analysis. This could possibly be an integration with the javascript library graphlib.
In terms of the canonical URL, I 100% agree that it should be used when nested inside other JSON schemas for instance. However for the sorts of applications I plan to build with it, I don't really want to have to do an HTTP request every time I need to get a reference to the schema, and I don't really want to embed it in the source code directly. Ideally it'd be versioned and on NPM so that when it changes, I can just update the version in my dependencies as well.
In terms of validation, I'm actually using JSON Schema for a bunch of my applications, and lately it looks like rather than tv4, is-my-json-valid is a faster validation library. Would you be interested in me contributing a validation library to the github org?
As well, I've actually worked a bunch with graphlib in the past, so I'd be interested in making a graphlib-json-graph
library for the cause as well.
Ok, I think I better understand your use case. I would agree that declaring a dependency on a particular published schema version is better than copying files everywhere. I've invited you to the jsongraph organization so you should have received an email.
Could you create a separate repository for the schema dependency? Maybe name the repository jsongraph-schema-js
, but the npm package name could be jsongraph-schema
.
Also feel free to start up repositories for javascript API libraries as well. Some of use would love to help out with that.
Awesome! I'll get right into it later this evening. So, for the jasongraph-schema-js
project, will I just be copying the json-graph-schema.json
file? All that is required to publish the schema itself on NPM is for there to be a package.json
file in the repo, so would it be possible to maybe just add that one file to the json-graph-specification
repo?
Would that get unwieldy as we evolve new versions of the schema? Could we have different package.json files defined for each version?
Well, the package.json would contain the version, and whenever we changed the schema we'd just bump the version and publish a new release to NPM. NPM will then keep track of versions and projects will be able to upgrade to the new version or stay with the older one as they see fit.
Will there be multiple schema files in the project at any given time? If there are multiple files, then the version in the package.json would have to be changed whenever any of those schemas got changed, and a new version would need to be published. Users of NPM can then install the dependency and import just those files that they require.
It'd be nice if this repo was published on NPM so that the schema could easily be required within a project.