schema-jsonld-context

returns jsonld context from json-schema

Showing:

Popularity

Downloads/wk

2

GitHub Stars

4

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

2

License

AGPL-3.0-or-later

Type Definitions

Tree-Shakeable

No?

Categories

Readme

schema-jsonld-context

returns a jsonld @context from a json-schema with prefixes and context properties.

supports

  • properties
  • additionalProperties
  • patternProperties
  • allOf
  • anyOf
  • oneOf
  • not
  • definitions
  • items schema
  • items array of schemas
  • additionalItems

pull requests welcome!

install

with npm, do:

npm i --save schema-jsonld-context

example

var schemaJsonldContext = require('schema-jsonld-context');

var personSchema = {
  id: "http://example.org/schemas/Person.json#",
  prefixes: {
    "": "http://schema.org/",
    "foaf": "http://xmlns.com/foaf/0.1/",
  },
  context: "foaf:Person",
  properties: {
    name: {
      context: "name",
      type: "string",
    },
    nick: {
      context: "foaf:nick",
      type: "string",
    },
  },
};

var personContext = schemaJsonldContext(personSchema);

console.log(JSON.stringify(personContext, null, 2));
// {
//  "@vocab": "http://schema.org/",
//  "foaf": "http://xmlns.com/foaf/0.1/",
//  "Person": "foaf:Person",
//  "nick": "foaf:nick"
// }

license

AGPLv3

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial