Structure 数据结构
结构声明
- TS Declaration
- Java Class
- JSON Schema
interface Structure {
"concept": "Structure", // 产品概念
"name": string, // 数据结构名称
"description": string, // 数据结构描述
"origin": "CallQueryComponent", // 数据结构来源
"typeParams": Array<TypeParam>, // 类型参数列表
"properties": Array<StructureProperty>, // 数据结构属性列表
}
class StructureTreeNode {
ConceptEnum concept; // 产品概念
String name; // 数据结构名称
String description; // 数据结构描述
OriginEnum origin; // 数据结构来源
List<TypeParamTreeNode> typeParams; // 类型参数列表
List<StructurePropertyTreeNode> properties; // 数据结构属性列表
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/Structure",
"definitions": {
"Structure": {
"type": "object",
"properties": {
"concept": {
"type": "string",
"const": "Structure"
},
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"origin": {
"type": "string",
"const": "CallQueryComponent"
},
"typeParams": {
"type": "array",
"items": {
"$ref": "#/definitions/TypeParam"
}
},
"properties": {
"type": "array",
"items": {
"$ref": "#/definitions/StructureProperty"
}
}
},
"required": [
"concept",
"name",
"description",
"origin",
"typeParams",
"properties"
],
"additionalProperties": false
}
}
}
示例
简单示例
- JSON
- YAML
{
"concept": "Structure",
"name": "CustomDetail",
"description": "自定义详情数据结构",
"origin": "CallQueryComponent",
"typeParams": null,
"properties": []
}
concept: Structure
name: CustomDetail
description: 自定义详情数据结构
origin: CallQueryComponent
typeParams: null
properties: []
带普通属性
- JSON
- YAML
- Embedded in TS
{
"concept": "Structure",
"name": "StudentResult",
"typeParams": [],
"properties": [{
"concept": "StructureProperty",
"name": "name",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "age",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}]
}
concept: Structure
name: StudentResult
typeParams: []
properties:
- concept: StructureProperty
name: name
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
typeArguments: null
- concept: StructureProperty
name: age
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
class StudentResult {
name: nasl.core.String;
age: nasl.core.Integer;
}
泛型数据结构
目前仅用于定义官方数据结构,暂不对用户开放编辑。
List
- JSON
- YAML
- Embedded in TS
{
"concept": "Structure",
"name": "List",
"typeParams": [{
"concept": "TypeParam",
"name": "T"
}],
"properties": [{
"concept": "StructureProperty",
"name": "length",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}]
}
concept: Structure
name: List
typeParams:
- concept: TypeParam
name: T
properties:
- concept: StructureProperty
name: length
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
class List<T> {
length: nasl.core.Integer;
}
ScopeOf
- JSON
- YAML
- Embedded in TS
{
"concept": "Structure",
"name": "ScopeOf",
"typeParams": [{
"concept": "TypeParam",
"name": "T"
}],
"properties": [{
"concept": "StructureProperty",
"name": "item",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "typeParam",
"typeNamespace": null,
"typeName": "T",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "index",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "rowIndex",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "columnIndex",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "value",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "String",
"typeArguments": null
}
}]
}
concept: Structure
name: ScopeOf
typeParams:
- concept: TypeParam
name: T
properties:
- concept: StructureProperty
name: item
typeAnnotation:
concept: TypeAnnotation
typeKind: typeParam
typeNamespace: null
typeName: T
typeArguments: null
- concept: StructureProperty
name: index
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: rowIndex
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: columnIndex
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: value
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: String
typeArguments: null
class ScopeOf<T> {
item: T;
index: nasl.core.Integer;
rowIndex: nasl.core.Integer;
columnIndex: nasl.core.Integer;
value: nasl.core.String;
}
PageOf
- JSON
- YAML
- Embedded in TS
{
"concept": "Structure",
"name": "PageOf",
"typeParams": [{
"concept": "TypeParam",
"name": "T"
}],
"properties": [{
"concept": "StructureProperty",
"name": "content",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "generic",
"typeNamespace": "nasl.collection",
"typeName": "List",
"typeArguments": [{
"concept": "TypeAnnotation",
"typeKind": "typeParam",
"typeNamespace": null,
"typeName": "T",
"typeArguments": null
}]
}
}, {
"concept": "StructureProperty",
"name": "number",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "size",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "totalPages",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}, {
"concept": "StructureProperty",
"name": "totalElements",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Integer",
"typeArguments": null
}
}]
}
concept: Structure
name: PageOf
typeParams:
- concept: TypeParam
name: T
properties:
- concept: StructureProperty
name: content
typeAnnotation:
concept: TypeAnnotation
typeKind: generic
typeNamespace: nasl.collection
typeName: List
typeArguments:
- concept: TypeAnnotation
typeKind: typeParam
typeNamespace: null
typeName: T
typeArguments: null
- concept: StructureProperty
name: number
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: size
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: totalPages
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
- concept: StructureProperty
name: totalElements
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Integer
typeArguments: null
class PageOf<T> {
content: nasl.collection.List<T>;
number: nasl.core.Integer;
size: nasl.core.Integer;
totalPages: nasl.core.Integer;
totalElements: nasl.core.Integer;
}