Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
express-json-schema
Advanced tools
Readme
Adds express res.jsonSchema
method to allow automatic generation of JSON schemas from a JS/JSON files containing @schema @schema tags
npm install --save express-json-schema
var app = require('express')(),
expJsonSchema = require('express-json-schema');
// add as middleware
app.use(expJsonSchema);
// use within route handler
app.get('/', function(req, res){
// return json schema for person.js file using new res.jsonSchema method
res.jsonSchema('./examples/person.js');
});
// start the server
app.listen(8080, function(){
console.log('Example app listening on port 8080');
});
/**
* @schema.name Person
* @schema.description This is an example Person object marked up with JSON schema tags to allow schema generation
*/
var Person = {
/**
* @schema.title Name
* @schema.description Please enter your full name
* @schema.type string
* @schema.maxLength 30
* @schema.minLength 1
* @schema.required true
*/
name: '',
/**
* @schema.title Job Title
* @schema.type string
*/
jobTitle: '',
/**
* @schema.title Telephone Number
* @schema.description Please enter telephone number including country code
* @schema.type string
* @schema.required true
*/
telephone: '',
/**
* @schema.type string
* @schema.required true
*/
dateOfBirth: '',
/**
* @schema.type object
*/
address: {
}
};
{
"name": "Person",
"description": "This is an example Person object marked up with JSON schema tags to allow schema generation",
"properties": {
"name": {
"title": "Name",
"description": "Please enter your full name",
"type": "string",
"maxLength": 30,
"minLength": 1,
"required": true
},
"jobTitle": {
"title": "Job Title",
"type": "string"
},
"telephone": {
"title": "Telephone Number",
"description": "Please enter telephone number including country code",
"type": "string",
"required": true
},
"dateOfBirth": {
"type": "string",
"required": true
},
"address": {
"type": "object"
}
}
}
A list of supported tags can be viewed at jsdoc-to-json-schema
ISC License © 2016 John Doherty
FAQs
Adds express method to allow automatic generation of JSON schemas from a JS/JSON files containing @schema tags
The npm package express-json-schema receives a total of 3 weekly downloads. As such, express-json-schema popularity was classified as not popular.
We found that express-json-schema demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.