Current collected state Current
Observed since 20 Oct, 19:31 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3c
json-schema api-doc mock-server
(sudo) npm install 3c -g
约定大于配置 尽量按照demo书写 否则不保证..
3c -i 或者 3c --init
环境初始化 生成对应的3个目录
默认是doc/api.md
{
"files": ["demo"], //接口 schema 文件位置
"format": "format/format", //特殊匹配规则 文件
"doc": "doc/api.md", //生成文档位置
"port": 1234, //mock server端口
"forceError": false, //是否强制mock server请求失败 并 访问失败的数据
"errorCode": 500 //mock server请求失败时的http code
}
demo.js: schema栗子
module.exports = [
meta: #接口相关基本藐视
title: 'test' #接口名称
description: 'just for test' #接口描述
host: 'http://localhost:1234'
uri: '/test'
method: 'get'
params: #请求参数
type: 'object'
properties:
token:
type: 'string'
required: ['token']
success: #请求成功
type: 'object'
required: ['array']
properties:
array:
type: 'array'
minItems: 8
maxItems: 10
items:
type: 'object'
required: ['id','name']
properties:
id:
type: 'integer'
description: 'id'
name:
type: 'string'
description: '姓名'
default: 'hello world'
error: #请求失败
type: 'object'
properties:
code:
type: 'integer'
msg:
type: 'string'
required: ['code']
]
3c -d 或者 3c --doc
按照schema 目录下的配置文件和json-schema文件 生成api文档
3c -m 或者 3c --mock
mock server 默认1234端口
3c -c 或者 3c --check
check server 默认4321端口 浏览器打开 http://localhost:4321 进行校验
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
coffee-scriptEnvironment{
"local_name": "coffee-script",
"alias": false,
"peer_metadata": null
} | 1.7.* | runtime |
optimistEnvironment{
"local_name": "optimist",
"alias": false,
"peer_metadata": null
} | 0.6.x | runtime |
commanderEnvironment{
"local_name": "commander",
"alias": false,
"peer_metadata": null
} | 1.3.x | runtime |
handlebarsEnvironment{
"local_name": "handlebars",
"alias": false,
"peer_metadata": null
} | 1.3.0 | runtime |
underscoreEnvironment{
"local_name": "underscore",
"alias": false,
"peer_metadata": null
} | 1.5.x | runtime |
randexpEnvironment{
"local_name": "randexp",
"alias": false,
"peer_metadata": null
} | 0.3.3 | runtime |
restifyEnvironment{
"local_name": "restify",
"alias": false,
"peer_metadata": null
} | 2.8.1 | runtime |
jayschemaEnvironment{
"local_name": "jayschema",
"alias": false,
"peer_metadata": null
} | 0.2.7 | runtime |
Source distribution
{
"shasum": "8b346c46c5460850c714b1a687c88131853b3fbe",
"tarball": "https://registry.npmjs.org/3c/-/3c-0.0.3-alpha.tgz",
"integrity": "sha512-/tqpZB3Lh8gP6JxrxNhk61RC1UZaM7TAk3moetoQspe2bDIDMRvPbFAY8hYqox6b5zeSkJUyxOahC/Nm8dXwgg==",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCID4tfXCfgUCcL2c74DvTKbcNtyvb+wLU9IvinhZpX/jWAiEA1kKXBBPWH15ngZ1HgkFSWGFAoY9GlCqLkxV+D3/mAq4="
}
]
}Shared repository data · GitHub
Observed since 20 Oct, 19:31 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:79275495b7b4ad943ef16913dfb34bd8a1d7dec3f8e960b92c97aa2e12830a4d