Interface 接口
结构声明
- TS Declaration
- Java Class
- JSON Schema
interface Interface {
"concept": "Interface", // 产品概念
"name": string, // 接口名称
"originLogicName": string, // originLogicName
"path": string, // path
"method": "GET" | "POST" | "PUT" | "DELETE", // method
"description": string, // 接口描述
"params": Array<InterfaceParam>, // 接口参数列表
"returns": Array<Return>, // 输出参数列表
}
class InterfaceTreeNode {
ConceptEnum concept; // 产品概念
String name; // 接口名称
String originLogicName; // originLogicName
String path; // path
MethodEnum method; // method
String description; // 接口描述
List<InterfaceParamTreeNode> params; // 接口参数列表
List<ReturnTreeNode> returns; // 输出参数列表
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Interface",
"definitions": {
"Interface": {
"type": "object",
"properties": {
"concept": {
"type": "string",
"const": "Interface"
},
"name": {
"type": "string"
},
"originLogicName": {
"type": "string"
},
"path": {
"type": "string"
},
"method": {
"type": "string",
"enum": [
"GET",
"POST",
"PUT",
"DELETE"
]
},
"description": {
"type": "string"
},
"params": {
"type": "array",
"items": {
"$ref": "#/definitions/InterfaceParam"
}
},
"returns": {
"type": "array",
"items": {
"$ref": "#/definitions/Return"
}
}
},
"required": [
"concept",
"name",
"originLogicName",
"path",
"method",
"description",
"params",
"returns"
],
"additionalProperties": false
}
}
}
示例
简单示例
- JSON
- YAML
{
"concept": "Interface",
"name": "GetUserList",
"originLogicName": "logic1",
"path": "GetUserList",
"method": "GET",
"description": "这是一个接口",
"params": [],
"returns": []
}
concept: Interface
name: GetUserList
originLogicName: logic1
path: GetUserList
method: GET
description: 这是一个接口
params: []
returns: []
ScopeOf
- JSON
- Embedded in TS
{}
declare function interface1(options: {
query1?: nasl.core.String;
query2?: nasl.core.String;
body: app.course.Student;
}): ApiReturnOf<Student>;