From b61baec7ea4d6fefa8fd14fb89262708597ef209 Mon Sep 17 00:00:00 2001 From: Vladimir Avchenov Date: Wed, 10 Apr 2024 18:07:32 +0300 Subject: [PATCH 1/2] Added multiline for @description attribute for securityDefinitions --- parser.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/parser.go b/parser.go index 561c4549e..8a47d0046 100644 --- a/parser.go +++ b/parser.go @@ -774,7 +774,10 @@ loopline: // Not mandatory field if securityAttr == descriptionAttr { - description = value + if description != "" { + description += "\n" + } + description += value } // next securityDefinitions From dd28e171ac7d0146fc8886ac11f290d74513a3b6 Mon Sep 17 00:00:00 2001 From: Vladimir Avtsenov Date: Mon, 22 Apr 2024 13:38:29 +0300 Subject: [PATCH 2/2] Added tests for multiline for @description attribute for securityDefinition --- parser_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/parser_test.go b/parser_test.go index 7862796d1..0479a7595 100644 --- a/parser_test.go +++ b/parser_test.go @@ -3864,6 +3864,24 @@ func TestTryAddDescription(t *testing.T) { }, }, }, + { + name: "added description with multiline", + lines: []string{ + "\t@securitydefinitions.apikey test", + "\t@in header", + "\t@name x-api-key", + "\t@description line1", + "\t@description line2", + }, + want: &spec.SecurityScheme{ + SecuritySchemeProps: spec.SecuritySchemeProps{ + Name: "x-api-key", + Type: "apiKey", + In: "header", + Description: "line1\nline2", + }, + }, + }, { name: "no description", lines: []string{