Skip to content

Commit a94a8b9

Browse files
committed
Doc sweep and dead code removal
1 parent 1b610d6 commit a94a8b9

File tree

7 files changed

+434
-135
lines changed

7 files changed

+434
-135
lines changed

changelog/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Gleece Changelog
22

3-
## Gleece v2.1.0
3+
## Gleece v2.0.0
44

55
### Summary
66

7-
*Gleece* 2.1 brings in concrete support for type aliases, map input/outputs and an overhauled type resolution system.
7+
*Gleece* 2.0 brings in concrete support for type aliases, map input/outputs and an overhauled type resolution system.
88

99
### Features
1010

definitions/consts.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package definitions
22

3+
// The name of the RFC7807 error struct
34
const Rfc7807ErrorName = "Rfc7807Error"
5+
6+
// The full package path of the RFC7807 error struct
47
const Rfc7807ErrorFullPackage = "github.com/gopher-fleece/runtime"
58

9+
// Defines Gleece's supported routing engines
610
var SupportedRoutingEngineStrings = []string{
711
string(RoutingEngineGin),
812
string(RoutingEngineEcho),

definitions/enums.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const (
1111
PassedInForm ParamPassedIn = "Form"
1212
)
1313

14+
// An HTTP verb such as POST or GET
1415
type HttpVerb string
1516

1617
const (
@@ -25,6 +26,7 @@ const (
2526
HttpConnect HttpVerb = "CONNECT"
2627
)
2728

29+
// An HTTP Content-Type
2830
type ContentType string
2931

3032
const (
@@ -44,11 +46,17 @@ const (
4446
ContentTypeCSS ContentType = "text/css"
4547
)
4648

49+
// An API method's visibility in the generated OpenAPI schema
4750
type HideMethodType string
4851

4952
const (
50-
HideMethodNever HideMethodType = "Never"
51-
HideMethodAlways HideMethodType = "Always"
53+
// Never hide this endpoint
54+
HideMethodNever HideMethodType = "Never"
55+
// Always hide this endpoint
56+
HideMethodAlways HideMethodType = "Always"
57+
// ***NOT YET IMPLEMENTED***
58+
//
59+
// Hide this method if the given condition is met
5260
HideMethodCondition HideMethodType = "Condition"
5361
)
5462

@@ -79,6 +87,8 @@ const (
7987
HttpAuthSchemeVapid HttpAuthScheme = "vapid"
8088
)
8189

90+
// The security schema type for API authorization,
91+
// that is, the definition of authentication the API server
8292
type SecuritySchemeType string
8393

8494
const (
@@ -88,6 +98,7 @@ const (
8898
HTTP SecuritySchemeType = "http"
8999
)
90100

101+
// The way in which consumers are to pass authorization to the API server
91102
type SecuritySchemeIn string
92103

93104
const (
@@ -97,6 +108,7 @@ const (
97108
InCookie SecuritySchemeIn = "cookie"
98109
)
99110

111+
// The API server's underlying routing engine
100112
type RoutingEngineType string
101113

102114
const (

definitions/helpers.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ var validHttpStatusCode = map[uint]struct{}{
9797
uint(runtime.StatusNetworkAuthenticationRequired): {},
9898
}
9999

100+
// GetValidHttpVerbs returns a list of all valid HTTP verbs
100101
func GetValidHttpVerbs() []string {
101102
verbs := make([]string, 0, len(validHttpVerbs))
102103
for verb := range validHttpVerbs {
@@ -105,12 +106,14 @@ func GetValidHttpVerbs() []string {
105106
return verbs
106107
}
107108

109+
// GetRouteSupportedHttpVerbs returns a list of all HTTP verbs that are valid in the context of an API Endpoint
108110
func GetRouteSupportedHttpVerbs() []string {
109111
verbs := common.MapKeys(routeSupportedHttpVerbs)
110112
slices.Sort(verbs)
111113
return verbs
112114
}
113115

116+
// GetValidHttpStatusCodes returns a list of all known/valid HTTP Status Codes
114117
func GetValidHttpStatusCodes() []uint {
115118
codes := make([]uint, 0, len(validHttpStatusCode))
116119
for code := range validHttpStatusCode {
@@ -119,28 +122,27 @@ func GetValidHttpStatusCodes() []uint {
119122
return codes
120123
}
121124

125+
// IsValidHttpVerb determines whether a given string is a valid HTTP verb
122126
func IsValidHttpVerb(verb string) bool {
123127
_, exists := validHttpVerbs[verb]
124128
return exists
125129
}
126130

131+
// IsValidRouteHttpVerb determines whether a given string is an HTTP verb
132+
// that is valid in the context of an API endpoint
127133
func IsValidRouteHttpVerb(verb string) bool {
128134
_, exists := routeSupportedHttpVerbs[verb]
129135
return exists
130136
}
131137

132-
func EnsureValidHttpVerb(verb string) HttpVerb {
133-
if IsValidHttpVerb(verb) {
134-
return HttpVerb(verb)
135-
}
136-
panic(fmt.Sprintf("'%s' is not a valid HTTP verb", verb))
137-
}
138-
138+
// IsValidHttpStatusCode determines whether the given code is a known, valid HTTP Status Code
139139
func IsValidHttpStatusCode(code uint) bool {
140140
_, exists := validHttpStatusCode[code]
141141
return exists
142142
}
143143

144+
// ConvertToHttpStatus attempts to convert the given code into an HTTP Status Code.
145+
// Returns an error if the given code is invalid.
144146
func ConvertToHttpStatus(code string) (runtime.HttpStatusCode, error) {
145147
parsed, err := strconv.ParseUint(code, 10, 32)
146148
if err != nil {
@@ -154,6 +156,9 @@ func ConvertToHttpStatus(code string) (runtime.HttpStatusCode, error) {
154156
return runtime.HttpStatusCode(parsedCode), nil
155157
}
156158

159+
// PermissionStringToFileMod converts the given permission string into a FileMode.
160+
//
161+
// Input is expected to be a valid octal permission value like '0777'
157162
func PermissionStringToFileMod(permissionString string) (os.FileMode, error) {
158163
permission, err := strconv.ParseUint(permissionString, 8, 32)
159164
// A proper mask needs to account for sticky/setuid/setgid bitflags

0 commit comments

Comments
 (0)