MetadataType 元数据类型
1. 结构声明
- TS Declaration
- JSON Schema
class MetadataType extends BaseNode {
name: string = '';
label: string = '元数据';
description?: string;
typeAnnotation: TypeAnnotation;
rules: Array<ValidationRule>;
playground: Array<LogicItem>;
uuid: uuid;
}
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"label": {
"type": "string"
},
"description": {
"type": "string"
},
"typeAnnotation": {
"$ref": "#/definitions/TypeAnnotation"
},
"rules": {
"type": "array",
"items": {
"$ref": "#/definitions/ValidationRule"
}
},
"playground": {
"type": "array",
"items": {
"$ref": "#/definitions/LogicItem"
}
},
"uuid": {
"$ref": "#/definitions/uuid"
}
},
"required": [
"name",
"label",
"typeAnnotation",
"rules",
"playground",
"uuid"
],
"additionalProperties": false
}
2. 节点示例
(1) 示例
AST 如下:
- JSON
- YAML
{
"concept": "MetadataType",
"name": "Currency",
"label": "货币",
"uuid": "83450632af284642ab5c967e82d49be4",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Decimal",
"inferred": false,
"ruleMap": {}
},
"rules": [
{
"concept": "ValidationRule",
"calleeNamespace": "nasl.validation",
"calleeName": "min",
"arguments": [
{
"concept": "Argument",
"keyword": "min",
"expression": {
"concept": "NumericLiteral",
"value": "0",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
}
],
"target": {
"concept": "Identifier",
"namespace": "",
"name": ""
},
"enableServerValidation": true
},
{
"concept": "ValidationRule",
"calleeNamespace": "nasl.validation",
"calleeName": "max",
"arguments": [
{
"concept": "Argument",
"keyword": "max",
"expression": {
"concept": "NumericLiteral",
"value": "99999999",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
}
],
"target": {
"concept": "Identifier",
"namespace": "",
"name": ""
},
"enableServerValidation": true
}
],
"playground": []
}
concept: MetadataType
name: Currency
label: 货币
uuid: 83450632af284642ab5c967e82d49be4
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Decimal
inferred: false
ruleMap: {}
rules:
- concept: ValidationRule
calleeNamespace: nasl.validation
calleeName: min
arguments:
- concept: Argument
keyword: min
expression:
concept: NumericLiteral
value: "0"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
target:
concept: Identifier
namespace: ""
name: ""
enableServerValidation: true
- concept: ValidationRule
calleeNamespace: nasl.validation
calleeName: max
arguments:
- concept: Argument
keyword: max
expression:
concept: NumericLiteral
value: "99999999"
typeAnnotation:
concept: TypeAnnotation
typeKind: primitive
typeNamespace: nasl.core
typeName: Long
inferred: false
ruleMap: {}
target:
concept: Identifier
namespace: ""
name: ""
enableServerValidation: true
playground: []