![PyPI Slashes Malware Response Time: 90% of Issues Resolved in Under 24 Hours](https://cdn.sanity.io/images/cgdhsj6q/production/eee3e3fc69826f43dfc3366b71472d981003a5cb-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Slashes Malware Response Time: 90% of Issues Resolved in Under 24 Hours
PyPI has drastically improved its malware response times, resolving 90% of issues in under 24 hours and removing 900 projects since March 2024.
protagonist
Advanced tools
Changelog
2.0.0-pre.1
This update now uses Drafter 4.0.0-pre.1. Please see Drafter 4.0.0-pre.1 for the list of changes.
Readme
Protagonist is a Node.js wrapper for the Drafter library.
API Blueprint is Web API documentation language. You can find API Blueprint documentation on the API Blueprint site.
NOTE: For general use we recommend that you use the Drafter NPM package instead of Protagonist directly as Protagonist needs to be compiled which may not be possible in every situation
The best way to install Protagonist is by using its NPM package.
$ npm install protagonist
NOTE: Installing Protagonist depends on having Python 2 installed along with a compiler such as GCC, Clang or MSVC.
Tested with node.js 4, 6, 7
var protagonist = require('protagonist');
protagonist.parse('# My API', function(error, result) {
if (error) {
console.log(error);
return;
}
console.log(result);
});
If you for some reason need to use the API synchronously, that is also possible. Please note that the recommended way is to use the asynchronous API as to not block the event loop.
var result = protagonist.parseSync('# My API');
Options can be passed to the parser as an optional second argument to both the asynchronous and synchronous interfaces:
var options = {
generateSourceMap: true
}
protagonist.parse('# My API', options, callback);
The available options are:
Name | Description |
---|---|
requireBlueprintName | Require parsed blueprints have a title (default: false) |
generateSourceMap | Enable sourcemap generation (default: false) |
Parsing this blueprint:
# GET /
+ Response 204
will produce the following object (result
variable):
{
"element": "parseResult",
"content": [
{
"element": "category",
"meta": {
"classes": {
"element": "array",
"content": [
{
"element": "string",
"content": "api"
}
]
},
"title": {
"element": "string",
"content": ""
}
},
"content": [
{
"element": "resource",
"meta": {
"title": {
"element": "string",
"content": ""
}
},
"attributes": {
"href": {
"element": "string",
"content": "/"
}
},
"content": [
{
"element": "transition",
"meta": {
"title": {
"element": "string",
"content": ""
}
},
"content": [
{
"element": "httpTransaction",
"content": [
{
"element": "httpRequest",
"attributes": {
"method": {
"element": "string",
"content": "GET"
}
},
"content": []
},
{
"element": "httpResponse",
"attributes": {
"statusCode": {
"element": "string",
"content": "204"
}
},
"content": []
}
]
}
]
}
]
}
]
}
]
}
You are welcome to contribute. Use following steps to build & test Protagonist.
Protagonist uses node-gyp build tool.
If needed, install node-gyp:
$ npm install -g node-gyp
Clone the repository, and fetch the submodules:
$ git clone --recursive git://github.com/apiaryio/protagonist.git
$ cd protagonist
$ npm install
Build:
$ node-gyp configure
$ node-gyp build
Inside the protagonist repository run:
$ npm test
Fork & Pull Request.
MIT License. See the LICENSE file.
FAQs
API Blueprint Parser
The npm package protagonist receives a total of 6,590 weekly downloads. As such, protagonist popularity was classified as popular.
We found that protagonist demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
PyPI has drastically improved its malware response times, resolving 90% of issues in under 24 hours and removing 900 projects since March 2024.
Security News
Research
The Socket Research team breaks down an obfuscated script designed to facilitate unauthorized file uploads to multiple external services.
Security News
Node.js has automated its security release process, doubling the number of releases, and is re-evaluating unsupported experimental features with the Next 10 group to enhance security.