-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
224 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,217 @@ | ||
{ | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"title": "Ruleset Schema", | ||
"type": "object", | ||
"$ref": "#/definitions/intermediate", | ||
"definitions": { | ||
"rule": { | ||
"type": "object", | ||
"title": "Rule", | ||
"description": "A single rule.", | ||
"properties": { | ||
"mode": { | ||
"type": "string", | ||
"title": "Mode", | ||
"description": "Mode of the rule.", | ||
"enum": [ | ||
"white", | ||
"black", | ||
"param", | ||
"regex", | ||
"redirect", | ||
"visit", | ||
"lambda" | ||
] | ||
}, | ||
"description": { | ||
"type": "string", | ||
"title": "Description", | ||
"description": "Description of the rule." | ||
}, | ||
"author": { | ||
"type": "string", | ||
"title": "Author", | ||
"description": "Author of the rule." | ||
}, | ||
"std": { | ||
"type": "boolean", | ||
"title": "Standard", | ||
"description": "Whether the URL search string shall be deemed standard." | ||
}, | ||
"params": { | ||
"type": "array", | ||
"title": "Params", | ||
"description": "List of parameters to be kept, removed or processed.", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"acts": { | ||
"type": "array", | ||
"title": "Acts", | ||
"description": "List of actions to be performed.", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"regex": { | ||
"type": "array", | ||
"title": "Regex", | ||
"description": "List of regular expressions to be matched.", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"replace": { | ||
"type": "array", | ||
"title": "Replace", | ||
"description": "List of strings to replace matched parts.", | ||
"items": { | ||
"type": "string" | ||
} | ||
}, | ||
"headers": { | ||
"type": "object", | ||
"title": "Headers", | ||
"description": "The headers to use for web requests.", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"lambda": { | ||
"type": "string", | ||
"title": "Lambda", | ||
"description": "The lambda function to use for processing." | ||
}, | ||
"continue": { | ||
"type": "boolean", | ||
"title": "Continue", | ||
"description": "Whether to continue processing the URL." | ||
} | ||
}, | ||
"required": [ | ||
"mode", | ||
"description", | ||
"author" | ||
], | ||
"allOf": [ | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "white" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [ | ||
"params" | ||
] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "black" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [ | ||
"params" | ||
] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "param" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [ | ||
"params" | ||
] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "regex" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [ | ||
"regex", | ||
"replace" | ||
] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "redirect" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "visit" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [] | ||
} | ||
}, | ||
{ | ||
"if": { | ||
"properties": { | ||
"mode": { | ||
"const": "lambda" | ||
} | ||
} | ||
}, | ||
"then": { | ||
"required": [ | ||
"lambda" | ||
] | ||
} | ||
} | ||
], | ||
"additionalProperties": false | ||
}, | ||
"intermediate": { | ||
"type": "object", | ||
"title": "Intermediate", | ||
"description": "An intermediate object. Expects another intermediate if ends with a slash, otherwise a rule.", | ||
"patternProperties": { | ||
"^[^/]+/$": { | ||
"$ref": "#/definitions/intermediate" | ||
}, | ||
"^[^/]*$": { | ||
"$ref": "#/definitions/rule" | ||
}, | ||
"^/.+/$": { | ||
"$ref": "#/definitions/intermediate" | ||
}, | ||
"^/.+[^/]$": { | ||
"$ref": "#/definitions/rule" | ||
} | ||
} | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |