Skip to content

Commit fe1b662

Browse files
authored
Docs & Bugfixes (#45)
* Added some more documentation * Moved parsing regex outside Annotation Holder struct for better efficiency * Fixed an issue with alias descriptions being omitted * Aligned test files/expected results
1 parent aa5e9b1 commit fe1b662

27 files changed

+84
-81
lines changed

e2e/assets/openapi3.0.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

e2e/assets/openapi3.1.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

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
@@ -5,7 +5,7 @@ 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-03-30
8+
Generated Date: 2025-05-16
99
Target Engine: Chi v5 (https://github.com/go-chi/chi)
1010
--
1111
Usage:

e2e/chi/openapi/openapi3.0.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

e2e/chi/openapi/openapi3.1.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ 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-03-30
8+
Generated Date: 2025-05-16
99
Target Engine: Chi v5 (https://github.com/go-chi/chi)
1010
--
1111
Usage:
@@ -290,10 +290,10 @@ func RegisterCustomValidator(validateTagName string, validateFunc runtime.Valida
290290
}
291291
func RegisterRoutes(engine *chi.Mux) {
292292
urlParamRegex = regexp.MustCompile(`\{([\w\d-_]+)\}`)
293-
registerEnumValidation(validatorInstance, "status_enumeration_enum", []string{"active", "inactive"})
294293
registerEnumValidation(validatorInstance, "length_units_enum", []string{"Angstrom", "AstronomicalUnit", "Centimeter", "Chain", "DataMile", "Decameter", "Decimeter", "DtpPica", "DtpPoint", "Fathom", "Femtometer", "Foot", "Gigameter", "Hand", "Hectometer", "Inch", "Kilofoot", "KilolightYear", "Kilometer", "Kiloparsec", "Kiloyard", "LightYear", "MegalightYear", "Megameter", "Megaparsec", "Meter", "Microinch", "Micrometer", "Mil", "Mile", "Millimeter", "Nanometer", "NauticalMile", "Parsec", "Picometer", "PrinterPica", "PrinterPoint", "Shackle", "SolarRadius", "Twip", "UsSurveyFoot", "Yard"})
295-
registerEnumValidation(validatorInstance, "speed_units_enum", []string{"CentimeterPerHour", "CentimeterPerMinute", "CentimeterPerSecond", "DecimeterPerMinute", "DecimeterPerSecond", "FootPerHour", "FootPerMinute", "FootPerSecond", "InchPerHour", "InchPerMinute", "InchPerSecond", "KilometerPerHour", "KilometerPerMinute", "KilometerPerSecond", "Knot", "Mach", "MeterPerHour", "MeterPerMinute", "MeterPerSecond", "MicrometerPerMinute", "MicrometerPerSecond", "MilePerHour", "MillimeterPerHour", "MillimeterPerMinute", "MillimeterPerSecond", "NanometerPerMinute", "NanometerPerSecond", "UsSurveyFootPerHour", "UsSurveyFootPerMinute", "UsSurveyFootPerSecond", "YardPerHour", "YardPerMinute", "YardPerSecond"})
296294
registerEnumValidation(validatorInstance, "number_enumeration_enum", []string{"1", "2"})
295+
registerEnumValidation(validatorInstance, "speed_units_enum", []string{"CentimeterPerHour", "CentimeterPerMinute", "CentimeterPerSecond", "DecimeterPerMinute", "DecimeterPerSecond", "FootPerHour", "FootPerMinute", "FootPerSecond", "InchPerHour", "InchPerMinute", "InchPerSecond", "KilometerPerHour", "KilometerPerMinute", "KilometerPerSecond", "Knot", "Mach", "MeterPerHour", "MeterPerMinute", "MeterPerSecond", "MicrometerPerMinute", "MicrometerPerSecond", "MilePerHour", "MillimeterPerHour", "MillimeterPerMinute", "MillimeterPerSecond", "NanometerPerMinute", "NanometerPerSecond", "UsSurveyFootPerHour", "UsSurveyFootPerMinute", "UsSurveyFootPerSecond", "YardPerHour", "YardPerMinute", "YardPerSecond"})
296+
registerEnumValidation(validatorInstance, "status_enumeration_enum", []string{"active", "inactive"})
297297
// RegisterRoutesExtension - test
298298
// E2EController
299299
engine.Get(toChiUrl("/e2e/simple-get"), func(w http.ResponseWriter, ctx *http.Request) {

e2e/e2e_specification_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,21 @@ var _ = Describe("E2E Specification", func() {
3636
for _, engine := range engines {
3737
spec := GetEngineSpecification(engine, "openapi/openapi3.0.0.json")
3838
areEqual, _ := swagtool.AreJSONsIdentical([]byte(spec), []byte(expectedOpenapi300))
39-
Expect(areEqual).To(BeTrue())
39+
Expect(areEqual).To(BeTrueBecause(
40+
"Test for engine '%s' in version 3.0.0 yielded a difference between expected and generated spec",
41+
engine,
42+
))
4043
}
4144
})
4245

4346
It("Should generate a valid 3.1.0 specification", func() {
4447
for _, engine := range engines {
4548
spec := GetEngineSpecification(engine, "openapi/openapi3.1.0.json")
4649
areEqual, _ := swagtool.AreJSONsIdentical([]byte(spec), []byte(expectedOpenapi310))
47-
Expect(areEqual).To(BeTrue())
50+
Expect(areEqual).To(BeTrueBecause(
51+
"Test for engine '%s' in version 3.1.0 yielded a difference between expected and generated spec",
52+
engine,
53+
))
4854
}
4955
})
5056
})

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
@@ -5,7 +5,7 @@ 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-03-30
8+
Generated Date: 2025-05-16
99
Target Engine: Echo v4 (https://github.com/labstack/echo)
1010
--
1111
Usage:

e2e/echo/openapi/openapi3.0.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

e2e/echo/openapi/openapi3.1.0.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@
154154
"type": "string"
155155
},
156156
"NumberEnumeration": {
157+
"description": "Test enum with = flavor too",
157158
"enum": [
158159
"1",
159160
"2"

0 commit comments

Comments
 (0)