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.
serverless-api-blueprint
Advanced tools
Readme
This is API Documentation generator plugin for Serverless project. API Documentations are generated as API Blueprint format.
This can embed event.json
as request body and actual response to docs to help your API development.
You can install with following steps. (Requirement: Serverless v0.5 or higher)
npm install --save git+https://github.com/hiroara/serverless-api-blueprint.git
All configurations are defined under apib
namespace.
s-project.json
)targets
targets.<target name>.format
1A
only.1A
targets.<target name>.name
targets.<target name>.description
targets.<target name>.resourceGroups
targets.<target name>.resourceGroups.<name>.description
targets.<target name>.resourceGroups.<name>.resources
targets.<target name>.resourceGroups.<name>.resources.<resource path>.name
targets.<target name>.dataStructures
targets.<target name>.dataStructures.<structure name>.type
- Data type of data structures
object
targets.<target name>.dataStructures.<structure name>.attributes
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.type
string
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.required
string
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.example
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.default
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.description
targets.<target name>.dataStructures.<structure name>.attributes.<parameter name>.additionalDescription
{
...
"custom": {
"apib": {
"targets": {
"restApi": {
"format": "1A",
"name": "Awesome REST API",
"description": "This is Awesome REST API!",
"resourceGroups": {
...
"Users": {
"description": "Users registered in this service.",
"resources": {
"users/me": {
"name": "Resource Owner User"
}
}
},
...
},
"dataStructures": {
...
"Attachment": {
"type": "object",
"attributes": {
...
"name": {
"type": "string",
"description": "File name",
"example": "default.jpg"
}
...
}
}
...
}
}
}
}
},
...
}
<targetDir>/[<subFolders>]/<functionDir>/s-function.json
)Functions on Serverless framework are used as actions.
This plugin often uses each functions on Serverless framework as multiple actions on API Blueprint, because each functions can have multiple endpoints.
name
s-function.json
at path name
)description
request
false
(Do not generate)request.contentType
application/json
request.eventStructure
event.json
s-templates.json
request.eventStructure.body
event.json
response
false
(Do not generate)response.contentType
application/json
parameters
or attributes
dataStructures.<name>.attributes
{
...
"custom": {
"apib": {
"name": "Update an Cool Resource",
"description": "Update specific cool resource. You should call this API!",
"request": {
"contentType": "application/json",
"eventStructure": {
"body": "body"
}
},
"response": true,
"pathParameters": {
"cool_resource_id": {
"example": "dummy-resource-id",
"description": "Identifier of Target Resource",
"required": true
}
},
"attributes": {
...
"username": {
"type": "string",
"example": "test_user",
"description": "Name or email of the user",
"additionalDescription": "This parameter will be recognized whether name or email automatically.",
"required": true
},
...
}
}
},
...
}
You can generate docs following command.
sls apib generate
Or execute with --targets
or -t
option (comma separated).
sls apib generate --target restApiV1,restApiV2
Enjoy!
FAQs
Serverless API Blueprint - Generate API Docs as API Blurprint format ( https://apiblueprint.org ) from Serverless project ( http://www.serverless.com/ ).
The npm package serverless-api-blueprint receives a total of 0 weekly downloads. As such, serverless-api-blueprint popularity was classified as not popular.
We found that serverless-api-blueprint 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.