UNPKG

puer-mock

Version:

Puer + Mock.js = A configurable mock server with configurable mock(random) data.

111 lines 5.6 kB
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "JSON schema for puer-mock _mockserver.json config", "type": "object", "properties": { "api": { "type": "object", "title": "接口列表", "description": "接口列表", "patternProperties": { "^(GET|POST|PUT|DELETE|PATCH|OPTIONS)\\s+/\\S+$": { "type": "object", "title": "定义一个接口, 包含 HTTP 动词 + 空格 + 路由, 例如: GET /api/user", "description": "定义一个接口, 包含 HTTP 动词 + 空格 + 路由, 例如: GET /api/user", "default": "GET /api/user", "properties": { "request": { "type": "object", "title": "接口的输入参数", "description": "接口的输入参数", "properties": { "querystring": { "type": "object", "title": "定义放置在 URL querystring 中的参数", "description": "定义放置在 URL querystring 中的参数" }, "header": { "type": "object", "title": "定义 HTTP header", "description": "定义 HTTP header" }, "body": { "type": "object", "title": "定义放置在 HTTP body 中的参数", "description": "定义放置在 HTTP body 中的参数" } } }, "response": { "title": "接口的输出数据, 可以是任意的 JSON 数据类型(number/boolean/string/object/array/null), 但推荐返回固定结构的 object 类型的数据", "description": "接口的输出数据, 可以是任意的 JSON 数据类型(number/boolean/string/object/array/null), 但推荐返回固定结构的 object 类型的数据" }, "disabled": { "type": "boolean", "title": "是否禁用该接口", "description": "是否禁用该接口" }, "proxy": { "type": ["string", "object"], "title": "是否代理接口", "description": "直接代理远程的接口, 方便在开发的过程中切换到后端的真实接口" }, "info": { "type": "object", "title": "接口的介绍信息", "description": "接口的介绍信息", "properties": { "summary": { "type": "string", "title": "接口介绍", "description": "接口介绍", "default": "接口介绍" }, "module": { "type": "string", "title": "接口分组", "description": "接口分组", "default": "接口分组" }, "description": { "type": "string", "title": "接口详情", "description": "接口详情", "default": "接口详情" }, "author": { "type": "string", "title": "接口作者", "description": "接口作者", "default": "接口作者" } } } }, "required": ["response"] } }, "additionalProperties": false }, "info": { "type": "object", "title": "项目的介绍信息", "description": "项目的介绍信息", "properties": { "summary": { "type": "string", "title": "项目介绍", "description": "项目介绍", "default": "xxx 项目接口文档" }, "description": { "type": "string", "title": "项目详情", "description": "项目详情", "default": "如此高大上的接口文档 Powered by puer-mock" } } } }, "required": ["api"] }