@@ -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"
@@ -35,10 +35,9 @@ const (
3535 UserDataKey = "oapi-codegen/user-data"
3636)
3737
38- // This is an Echo middleware function which validates incoming HTTP requests
38+ // OapiValidatorFromYamlFile is an Echo middleware function which validates incoming HTTP requests
3939// to make sure that they conform to the given OAPI 3.0 specification. When
4040// OAPI validation fails on the request, we return an HTTP/400.
41-
4241// Create validator middleware from a YAML file path
4342func OapiValidatorFromYamlFile (path string ) (echo.MiddlewareFunc , error ) {
4443 data , err := os .ReadFile (path )
@@ -54,7 +53,7 @@ func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error) {
5453 return OapiRequestValidator (swagger ), nil
5554}
5655
57- // Create a validator from a swagger object.
56+ // OapiRequestValidator creates a validator from a swagger object.
5857func OapiRequestValidator (swagger * openapi3.T ) echo.MiddlewareFunc {
5958 return OapiRequestValidatorWithOptions (swagger , nil )
6059}
@@ -183,7 +182,7 @@ func ValidateRequestFromContext(ctx echo.Context, router routers.Router, options
183182 return nil
184183}
185184
186- // Helper function to get the echo context from within requests. It returns
185+ // GetEchoContext gets the echo context from within requests. It returns
187186// nil if not found or wrong type.
188187func GetEchoContext (c context.Context ) echo.Context {
189188 iface := c .Value (EchoContextKey )
0 commit comments