Skip to main content
Version: 3.3

ValidationRule 验证规则

1. 结构声明

class ValidationRule extends LogicItem {
calleeNamespace: string;
calleeName: string;
arguments: Array<Argument>;
errorMessage?: LogicItem;
target?: LogicItem;
enableServerValidation?: boolean = true;
}

2. 节点示例

(1) 示例

AST 如下:

{
"concept": "ValidationRule",
"calleeNamespace": "nasl.validation",
"calleeName": "maxLength",
"arguments": [
{
"concept": "Argument",
"keyword": "max",
"expression": {
"concept": "NumericLiteral",
"value": "100",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
}
],
"target": {
"concept": "Identifier",
"namespace": "",
"name": ""
},
"enableServerValidation": true
}

(2) 示例

AST 如下:

{
"concept": "ValidationRule",
"calleeNamespace": "nasl.validation",
"calleeName": "maxLength",
"arguments": [
{
"concept": "Argument",
"keyword": "max",
"expression": {
"concept": "NumericLiteral",
"value": "100",
"typeAnnotation": {
"concept": "TypeAnnotation",
"typeKind": "primitive",
"typeNamespace": "nasl.core",
"typeName": "Long",
"inferred": false,
"ruleMap": {}
}
}
}
],
"errorMessage": {
"concept": "StringLiteral",
"value": "格式不正确"
},
"target": {
"concept": "Identifier",
"namespace": "",
"name": ""
},
"enableServerValidation": true
}