Skip to content

openappjs/schema-prefix-uri

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

schema-prefix-uri

returns json-schema with any id's or $ref's prefixed as a uri

install

with npm, do:

npm i --save schema-prefix-uri

example

var schemaPrefixUri = require('schema-prefix-uri');


var agentSchema = {
  id: "Agent",
  oneOf: [{
    $ref: "Person",
  }, {
    $ref: "http://other.org/Group",
  }]
};

var prefix = "http://example.org/";

var prefixedAgentSchema = schemaPrefixUri(prefix, agentSchema);

console.log(JSON.stringify(prefixedAgentSchema, null, 2));
//{
//  "id": "http://example.org/Agent",
//  "oneOf": [
//    {
//      "$ref": "http://example.org/Person"
//    },
//    {
//      "$ref": "http://other.org/Group"
//    }
//  ]
//}

license

AGPLv3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published