StructureProperty 数据结构属性
1. 结构声明
- TS Declaration
- JSON Schema
class StructureProperty extends BaseNode {
name: string = '';
label?: string;
description?: string;
typeAnnotation?: TypeAnnotation;
defaultValue?: DefaultValue;
jsonName?: string;
}
{
"type": "object",
"properties": {
"composedBy": {
"type": "array",
"items": {
"type": "string"
}
},
"changedTime": {
"$ref": "#/definitions/long"
},
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"defaultValue": {
"$ref": "#/definitions/DefaultValue"
},
"jsonName": {
"type": "string"
}
},
"required": [
"name"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"description": "",
"jsonName": ""
}
concept: StructureProperty
name: count
label: 数量
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
description: ""
jsonName: ""
对应的代码如下:
- 文本化 NASL
- Natural TS
@(
label = "数量",
description = "",
jsonName = "",
)
count: Integer
count: Long
(2) 示例
AST 如下:
- JSON
- YAML
{
"concept": "StructureProperty",
"name": "count",
"label": "数量",
"description": "订单中该商品的数量",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
},
"jsonName": "count-",
"defaultValue": {
"concept": "DefaultValue",
"expression": {
"concept": "NumericLiteral",
"value": "120",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
},
"playground": []
}
}
concept: StructureProperty
name: count
label: 数量
description: 订单中该商品的数量
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
jsonName: count-
defaultValue:
concept: DefaultValue
expression:
concept: NumericLiteral
value: "120"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
playground: []
对应的代码如下:
- 文本化 NASL
- Natural TS
@(
label = "数量",
description = "订单中该商品的数量",
jsonName = "count-",
)
count: Integer = 120
count: Long