Skip to content

Commit 334d880

Browse files
committed
Allow Skip Generated date in generated routes comment
1 parent 6d21804 commit 334d880

24 files changed

Lines changed: 94 additions & 31 deletions

definitions/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ type RoutesConfig struct {
398398
TemplateOverrides map[string]string `json:"templateOverrides"`
399399
TemplateExtensions map[string]string `json:"templateExtensions"`
400400
ValidateResponsePayload bool `json:"validateResponsePayload"`
401+
SkipGenerateDateComment bool `json:"skipGenerateDateComment"`
401402
}
402403

403404
type AuthorizationConfig struct {

e2e/chi/ex_extra_routes/chi.e2e.ex_extra.gleece.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated Date: 2025-07-11
99
Target Engine: Chi v5 (https://github.com/go-chi/chi)
1010
--
1111
Usage:
12-
Refer to the Gleece documentation for details on how to use the generated routes and handlers.
12+
Refer to the Gleece documentation https://docs.gleece.dev for details on how to use the generated routes and handlers.
1313
--
1414
Repository: https://github.com/gopher-fleece/gleece
1515
--

e2e/chi/routes/chi.e2e.gleece.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ It includes routes and handlers by the Gleece API Routes Generator.
55
--
66
Authors: Haim Kastner & Yuval Pomerchik
77
Generated by: Gleece Routes Generator
8-
Generated Date: 2025-07-11
98
Target Engine: Chi v5 (https://github.com/go-chi/chi)
109
--
1110
Usage:
12-
Refer to the Gleece documentation for details on how to use the generated routes and handlers.
11+
Refer to the Gleece documentation https://docs.gleece.dev for details on how to use the generated routes and handlers.
1312
--
1413
Repository: https://github.com/gopher-fleece/gleece
1514
--

e2e/e2e.chi.gleece.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"JsonErrorResponseExtension": "./chi/assets/JsonErrorResponseExtension.hbs",
3232
"ResponseHeadersExtension": "./chi/assets/ResponseHeadersExtension.hbs"
3333
},
34-
"validateResponsePayload": true
34+
"validateResponsePayload": true,
35+
"skipGenerateDateComment": true
3536
},
3637
"openapiGeneratorConfig": {
3738
"openapi": "3.0.0",

e2e/e2e.echo.gleece.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"JsonErrorResponseExtension": "./echo/assets/JsonErrorResponseExtension.hbs",
3232
"ResponseHeadersExtension": "./echo/assets/ResponseHeadersExtension.hbs"
3333
},
34-
"validateResponsePayload": true
34+
"validateResponsePayload": true,
35+
"skipGenerateDateComment": true
3536
},
3637
"openapiGeneratorConfig": {
3738
"openapi": "3.0.0",

e2e/e2e.fiber.gleece.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"JsonErrorResponseExtension": "./fiber/assets/JsonErrorResponseExtension.hbs",
3232
"ResponseHeadersExtension": "./fiber/assets/ResponseHeadersExtension.hbs"
3333
},
34-
"validateResponsePayload": true
34+
"validateResponsePayload": true,
35+
"skipGenerateDateComment": true
3536
},
3637
"openapiGeneratorConfig": {
3738
"openapi": "3.0.0",

e2e/e2e.gin.gleece.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"JsonErrorResponseExtension": "./gin/assets/JsonErrorResponseExtension.hbs",
3232
"ResponseHeadersExtension": "./gin/assets/ResponseHeadersExtension.hbs"
3333
},
34-
"validateResponsePayload": true
34+
"validateResponsePayload": true,
35+
"skipGenerateDateComment": true
3536
},
3637
"openapiGeneratorConfig": {
3738
"openapi": "3.0.0",

e2e/e2e.mux.gleece.config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"JsonErrorResponseExtension": "./mux/assets/JsonErrorResponseExtension.hbs",
3232
"ResponseHeadersExtension": "./mux/assets/ResponseHeadersExtension.hbs"
3333
},
34-
"validateResponsePayload": true
34+
"validateResponsePayload": true,
35+
"skipGenerateDateComment": true
3536
},
3637
"openapiGeneratorConfig": {
3738
"openapi": "3.0.0",

e2e/e2e_generated_test.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package e2e
2+
3+
import (
4+
"fmt"
5+
"github.com/gopher-fleece/gleece/definitions"
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
8+
"os"
9+
)
10+
11+
var _ = Describe("E2E Generated Date Comment Test", func() {
12+
Context("When skipGenerateDateComment is true", func() {
13+
It("Should not include 'Generated Date: ' in generated files", func() {
14+
15+
for _, engine := range definitions.SupportedRoutingEngineStrings {
16+
filePath := fmt.Sprintf("./%s/routes/%s.e2e.gleece.go", engine, engine)
17+
18+
// Read the generated file
19+
content, err := os.ReadFile(filePath)
20+
Expect(err).ToNot(HaveOccurred(), "Failed to read generated file: "+filePath)
21+
22+
// Convert content to string and check for "Generated Date: "
23+
fileContent := string(content)
24+
25+
// Verify the file content doesn't contain "Generated Date: "
26+
Expect(fileContent).ToNot(ContainSubstring("Generated Date: "),
27+
"Generated file should not contain 'Generated Date: ' when skipGenerateDateComment is true: "+filePath)
28+
29+
// Verify the file was generated correctly (just a sanity check)
30+
Expect(fileContent).To(ContainSubstring("This file is automatically generated"),
31+
"Generated file should contain the standard header: "+filePath)
32+
}
33+
})
34+
35+
It("Should include 'Generated Date: ' in ex feature generated files", func() {
36+
37+
for _, engine := range definitions.SupportedRoutingEngineStrings {
38+
filePath := fmt.Sprintf("./%s/ex_extra_routes/%s.e2e.ex_extra.gleece.go", engine, engine)
39+
40+
// Read the generated file
41+
content, err := os.ReadFile(filePath)
42+
Expect(err).ToNot(HaveOccurred(), "Failed to read generated file: "+filePath)
43+
44+
// Convert content to string and check for "Generated Date: "
45+
fileContent := string(content)
46+
47+
// Verify the file content doesn't contain "Generated Date: "
48+
Expect(fileContent).To(ContainSubstring("Generated Date: "),
49+
"Generated file should not contain 'Generated Date: ' when skipGenerateDateComment is true: "+filePath)
50+
51+
// Verify the file was generated correctly (just a sanity check)
52+
Expect(fileContent).To(ContainSubstring("This file is automatically generated"),
53+
"Generated file should contain the standard header: "+filePath)
54+
}
55+
})
56+
57+
})
58+
})

e2e/echo/ex_extra_routes/echo.e2e.ex_extra.gleece.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Generated Date: 2025-07-11
99
Target Engine: Echo v4 (https://github.com/labstack/echo)
1010
--
1111
Usage:
12-
Refer to the Gleece documentation for details on how to use the generated routes and handlers.
12+
Refer to the Gleece documentation https://docs.gleece.dev for details on how to use the generated routes and handlers.
1313
--
1414
Repository: https://github.com/gopher-fleece/gleece
1515
--

0 commit comments

Comments
 (0)