@@ -18,8 +18,8 @@ import (
1818 "context"
1919 "errors"
2020 "fmt"
21- "os"
2221 "net/http"
22+ "os"
2323 "strings"
2424
2525 "github.com/getkin/kin-openapi/openapi3"
@@ -34,7 +34,7 @@ const (
3434 UserDataKey = "oapi-codegen/user-data"
3535)
3636
37- // Create validator middleware from a YAML file path
37+ // OapiValidatorFromYamlFile creates a validator middleware from a YAML file path
3838func OapiValidatorFromYamlFile (path string ) (gin.HandlerFunc , error ) {
3939 data , err := os .ReadFile (path )
4040 if err != nil {
@@ -49,7 +49,7 @@ func OapiValidatorFromYamlFile(path string) (gin.HandlerFunc, error) {
4949 return OapiRequestValidator (swagger ), nil
5050}
5151
52- // This is an gin middleware function which validates incoming HTTP requests
52+ // OapiRequestValidator is an gin middleware function which validates incoming HTTP requests
5353// to make sure that they conform to the given OAPI 3.0 specification. When
5454// OAPI validation fails on the request, we return an HTTP/400 with error message
5555func OapiRequestValidator (swagger * openapi3.T ) gin.HandlerFunc {
@@ -72,7 +72,7 @@ type Options struct {
7272 MultiErrorHandler MultiErrorHandler
7373}
7474
75- // Create a validator from a swagger object, with validation options
75+ // OapiRequestValidatorWithOptions creates a validator from a swagger object, with validation options
7676func OapiRequestValidatorWithOptions (swagger * openapi3.T , options * Options ) gin.HandlerFunc {
7777 router , err := gorillamux .NewRouter (swagger )
7878 if err != nil {
@@ -156,7 +156,7 @@ func ValidateRequestFromContext(c *gin.Context, router routers.Router, options *
156156 return nil
157157}
158158
159- // Helper function to get the echo context from within requests. It returns
159+ // GetGinContext gets the echo context from within requests. It returns
160160// nil if not found or wrong type.
161161func GetGinContext (c context.Context ) * gin.Context {
162162 iface := c .Value (GinContextKey )
0 commit comments