diff --git a/schema/ridl/parser.go b/schema/ridl/parser.go index 1ce2777c..33d2f720 100644 --- a/schema/ridl/parser.go +++ b/schema/ridl/parser.go @@ -539,12 +539,12 @@ func parseComments(comments map[int]string, currentLine int) string { break } + iteration++ + // if there are 2 lines of empty space => no comment we don't read more lines if iteration > 1 { break } - - iteration++ } if len(c) > 0 { diff --git a/schema/ridl/parser_test.go b/schema/ridl/parser_test.go index bbfe1089..57c8c668 100644 --- a/schema/ridl/parser_test.go +++ b/schema/ridl/parser_test.go @@ -1004,6 +1004,9 @@ func TestParseServiceComments(t *testing.T) { #! skip more lines #! more - Version() => (details: any) + # test comment two lines above + + - Version2() => (details: any) `) assert.NoError(t, err) @@ -1018,4 +1021,5 @@ func TestParseServiceComments(t *testing.T) { assert.Equal(t, "Contacts service line 1\nContacts service line 2\nContacts service line 3", serviceNode.comment) assert.Equal(t, "GetContact gives you contact for specific id\nsee https://www.example.com/?first=1&second=12#help", serviceNode.methods[0].comment) assert.Equal(t, "Version returns you current deployed version\n", serviceNode.methods[1].comment) + assert.Equal(t, "", serviceNode.methods[2].comment) }