Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Add schema.json files for parser message types
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldingAustin committed Jun 21, 2023
1 parent fc62f8c commit 568fa50
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 6 deletions.
2 changes: 1 addition & 1 deletion parsers/parser-core/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ tasks:
deps:
- ~:build-node
generate:
command: 'tsx ./src/json-schema-generator/generator.ts'
command: 'tsx ./src/generator.ts'
27 changes: 27 additions & 0 deletions parsers/parser-core/schemas/logging.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$ref": "#/definitions/LoggerOptions",
"definitions": {
"LoggerOptions": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"level": {
"enum": ["debug", "error", "warn"],
"type": "string"
},
"error": {},
"payload": {}
},
"required": ["message"]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}
136 changes: 136 additions & 0 deletions parsers/parser-core/schemas/parser-info.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"$ref": "#/definitions/ParserInfo",
"definitions": {
"ParserInfo": {
"type": "object",
"properties": {
"version": {
"description": "The version of the RedEye parser config that the parser is compatible with",
"type": "number"
},
"id": {
"description": "ID for parser, should match the standard name of the binary file or command",
"type": "string"
},
"name": {
"description": "The name of the parser",
"type": "string"
},
"description": {
"description": "An optional description of the parser",
"type": "string"
},
"uploadForm": {
"$ref": "#/definitions/UploadForm",
"description": "An object that configures the upload form"
}
},
"required": ["id", "name", "uploadForm", "version"]
},
"UploadForm": {
"type": "object",
"properties": {
"tabTitle": {
"description": "The title of the tab in the upload form",
"type": "string"
},
"enabledInBlueTeam": {
"description": "Whether the parser is enabled in blue team mode\nThis should be false unless the parser is intended to be used by a blue team\nThe Blue team mode is intended to be a read only mode",
"type": "boolean"
},
"serverDelineation": {
"$ref": "#/definitions/ServerDelineationTypes",
"description": "The type of server delineation used by the parser"
},
"fileUpload": {
"description": "An object that configures the file upload portion of the upload form",
"anyOf": [
{
"allOf": [
{
"$ref": "#/definitions/FileUpload"
},
{
"type": "object",
"properties": {
"validate": {
"enum": ["none", "parser"],
"type": "string"
}
},
"required": ["validate"]
}
]
},
{
"allOf": [
{
"$ref": "#/definitions/FileUpload"
},
{
"type": "object",
"properties": {
"validate": {
"description": "validate uploaded files in client by file extensions",
"type": "string",
"const": "file-extensions"
},
"acceptedExtensions": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["acceptedExtensions", "validate"]
}
]
}
]
},
"fileDisplay": {
"$ref": "#/definitions/FileDisplay",
"description": "An object that configures the display of servers/files after upload"
}
},
"required": ["enabledInBlueTeam", "fileDisplay", "fileUpload", "serverDelineation", "tabTitle"]
},
"ServerDelineationTypes": {
"enum": ["database", "folder"],
"type": "string"
},
"FileUpload": {
"type": "object",
"properties": {
"type": {
"$ref": "#/definitions/UploadType",
"description": "The type of upload, a selection of files or a directory"
},
"description": {
"description": "Describes what should be uploaded for the selected parser",
"type": "string"
},
"example": {
"description": "A string that will be displayed in the upload form as an example of the type of file or shape of directory to upload",
"type": "string"
}
},
"required": ["description", "type"]
},
"UploadType": {
"enum": ["directory", "file"],
"type": "string"
},
"FileDisplay": {
"type": "object",
"properties": {
"editable": {
"description": "Whether the names of the servers inferred from the uploaded files are editable\nA user may want to change the name of a server to something more descriptive",
"type": "boolean"
}
},
"required": ["editable"]
}
},
"$schema": "http://json-schema.org/draft-07/schema#"
}

0 comments on commit 568fa50

Please sign in to comment.