From eba34ad56cd9640e07085fe5cc2d9af787424fd5 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Thu, 25 May 2023 16:34:47 +0000 Subject: [PATCH] Auto Generate Syntax Docs + JSONSchema [Thu May 25 16:34:47 UTC 2023] :robot: --- SYNTAX-REFERENCE.md | 13 +++++++++++++ nuclei-jsonschema.json | 10 ++++++++++ v2/pkg/templates/templates_doc.go | 7 ++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/SYNTAX-REFERENCE.md b/SYNTAX-REFERENCE.md index 8f02bb4fd..da73e9a3e 100755 --- a/SYNTAX-REFERENCE.md +++ b/SYNTAX-REFERENCE.md @@ -351,6 +351,19 @@ Variables contains any variables for the current request.
+
+ +constants map[string]interface{} + +
+
+ +Constants contains any scalar costant for the current template + +
+ +
+ diff --git a/nuclei-jsonschema.json b/nuclei-jsonschema.json index 09e02030e..cccc49b2f 100644 --- a/nuclei-jsonschema.json +++ b/nuclei-jsonschema.json @@ -1474,6 +1474,16 @@ "$ref": "#/definitions/variables.Variable", "title": "variables for the http request", "description": "Variables contains any variables for the current request" + }, + "constants": { + "patternProperties": { + ".*": { + "additionalProperties": true + } + }, + "type": "object", + "title": "constant for the template", + "description": "constants contains any constant for the template" } }, "additionalProperties": false, diff --git a/v2/pkg/templates/templates_doc.go b/v2/pkg/templates/templates_doc.go index ecc417360..69466296e 100644 --- a/v2/pkg/templates/templates_doc.go +++ b/v2/pkg/templates/templates_doc.go @@ -42,7 +42,7 @@ func init() { TemplateDoc.Type = "Template" TemplateDoc.Comments[encoder.LineComment] = " Template is a YAML input file which defines all the requests and" TemplateDoc.Description = "Template is a YAML input file which defines all the requests and\n other metadata for a template." - TemplateDoc.Fields = make([]encoder.Doc, 16) + TemplateDoc.Fields = make([]encoder.Doc, 17) TemplateDoc.Fields[0].Name = "id" TemplateDoc.Fields[0].Type = "string" TemplateDoc.Fields[0].Note = "" @@ -138,6 +138,11 @@ func init() { TemplateDoc.Fields[15].Note = "" TemplateDoc.Fields[15].Description = "Variables contains any variables for the current request." TemplateDoc.Fields[15].Comments[encoder.LineComment] = "Variables contains any variables for the current request." + TemplateDoc.Fields[16].Name = "constants" + TemplateDoc.Fields[16].Type = "map[string]interface{}" + TemplateDoc.Fields[16].Note = "" + TemplateDoc.Fields[16].Description = "Constants contains any scalar costant for the current template" + TemplateDoc.Fields[16].Comments[encoder.LineComment] = "Constants contains any scalar costant for the current template" MODELInfoDoc.Type = "model.Info" MODELInfoDoc.Comments[encoder.LineComment] = " Info contains metadata information about a template"