Repository: deepmap/oapi-codegen (go)

Issue:
`BindStyledParameter` modifies header values
I have the following API spec:
```yaml
paths:
  /users/logout:
    post:
      tags:
        - users
      summary: Logs out current logged in user session
      operationId: logoutUser
      parameters:
      - name: x-auth-token
        schema: 
          type: string
        in: header
        required: true
      responses:
        '200':
          description: User logged out
        '401':
          description: No token present
```
the `x-auth-token` is a JWT token passed as a `header`. I generated a server for this spec, but noticed a bug in the API behavior, where valid JWT tokens passed to the API would turn out to be invalid when parsed. 

Upon debugging, I noticed that the JWT token that the code works with is different than the one passed to the API. The difference was that a `+` in the original token was converted to `" "` (space) in the code.

This is the generated code:
```go
// LogoutUser operation middleware
func (siw *ServerInterfaceWrapper) LogoutUser(w http.ResponseWriter, r *http.Request) {
        // more code
	
        // ------------- Required header parameter "x-auth-token" -------------
	if valueList, found := headers[http.CanonicalHeaderKey("x-auth-token")]; found {
		var XAuthToken string
		n := len(valueList)
		if n != 1 {
			http.Error(w, fmt.Sprintf("Expected one value for x-auth-token, got %d", n), http.StatusBadRequest)
			return
		}

		err = runtime.BindStyledParameter("simple", false, "x-auth-token", valueList[0], &XAuthToken)
		if err != nil {
			http.Error(w, fmt.Sprintf("Invalid format for parameter x-auth-token: %s", err), http.StatusBadRequest)
			return
		}

		params.XAuthToken = XAuthToken

	}

        // more code
``` 
the `XAuthToken` variable that holds the JWT token is populated via the `runtime.BindStyledParameter` function. `BindStyledParameter` calls `BindStyledParameterWithLocation(style, explode, paramName, ParamLocationUndefined, value, dest)` and `BindStyledParameterWithLocation` called with `ParamLocationUndefined` does query escaping logic:
```go
case ParamLocationQuery, ParamLocationUndefined:
		// We unescape undefined parameter locations here for older generated code,
		// since prior to this refactoring, they always query unescaped.
		value, err = url.QueryUnescape(value)
		if err != nil {
			return fmt.Errorf("error unescaping query parameter '%s': %v", paramName, err)
		}
```

I think that in this case we must call `BindStyledParameterWithLocation` with `ParamLocationHeader`, because we know that this parameter will be passed as a header, hence no query escaping is needed.

Pull request description:
Use `runtime.BindStyledParameterWithLocation` to parse headers
because at the point we call the function we know we are reading headers,
and because `runtime.BindStyledParameter` with `ParamLocationUndefined` does query escaping of the header value

Fixes #351

After I made the change in `pkg/codegen/templates/chi-middleware.tmpl` I ran `go generate ./pkg/codegen/templates` and `go generate ./...` as per https://github.com/deepmap/oapi-codegen#making-changes-to-code-generation. This produces the change in `internal/test/server/server.gen.go` and `pkg/codegen/templates/templates.gen.go`.

I also ran `go test ./...` locally to make sure the tests are passing, which they did.

Patch:
diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go
index bc06468..96e6faf 100644
--- a/examples/petstore-expanded/chi/api/petstore.gen.go
+++ b/examples/petstore-expanded/chi/api/petstore.gen.go
@@ -328,12 +328,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -348,7 +348,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/examples/petstore-expanded/echo/api/petstore-server.gen.go b/examples/petstore-expanded/echo/api/petstore-server.gen.go
index d9245d6..17ed78d 100644
--- a/examples/petstore-expanded/echo/api/petstore-server.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-server.gen.go
@@ -218,12 +218,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -238,7 +238,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/go.mod b/go.mod
index 1dd63fa..4537010 100644
--- a/go.mod
+++ b/go.mod
@@ -2,7 +2,7 @@ module github.com/deepmap/oapi-codegen
 
 require (
 	github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c
-	github.com/getkin/kin-openapi v0.53.0
+	github.com/getkin/kin-openapi v0.61.0
 	github.com/go-chi/chi/v5 v5.0.0
 	github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219
 	github.com/labstack/echo/v4 v4.2.1
diff --git a/go.sum b/go.sum
index 5658a41..4cdb220 100644
--- a/go.sum
+++ b/go.sum
@@ -5,8 +5,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
 github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
-github.com/getkin/kin-openapi v0.53.0 h1:7WzP+MZRRe7YQz2Kc74Ley3dukJmXDvifVbElGmQfoA=
-github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
+github.com/getkin/kin-openapi v0.61.0 h1:6awGqF5nG5zkVpMsAih1QH4VgzS8phTxECUWIFo7zko=
+github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
 github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/go-chi/chi/v5 v5.0.0 h1:DBPx88FjZJH3FsICfDAfIfnb7XxKIYVGG6lOPlhENAg=
diff --git a/pkg/chi-middleware/oapi_validate.go b/pkg/chi-middleware/oapi_validate.go
index d7398f4..d7db5c1 100644
--- a/pkg/chi-middleware/oapi_validate.go
+++ b/pkg/chi-middleware/oapi_validate.go
@@ -22,13 +22,13 @@ type Options struct {
 
 // OapiRequestValidator Creates middleware to validate request by swagger spec.
 // This middleware is good for net/http either since go-chi is 100% compatible with net/http.
-func OapiRequestValidator(swagger *openapi3.Swagger) func(next http.Handler) http.Handler {
+func OapiRequestValidator(swagger *openapi3.T) func(next http.Handler) http.Handler {
 	return OapiRequestValidatorWithOptions(swagger, nil)
 }
 
 // OapiRequestValidatorWithOptions Creates middleware to validate request by swagger spec.
 // This middleware is good for net/http either since go-chi is 100% compatible with net/http.
-func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *Options) func(next http.Handler) http.Handler {
+func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) func(next http.Handler) http.Handler {
 	router, err := legacy.NewRouter(swagger)
 	if err != nil {
 		panic(err)
diff --git a/pkg/codegen/codegen.go b/pkg/codegen/codegen.go
index f544e9a..dca61a1 100644
--- a/pkg/codegen/codegen.go
+++ b/pkg/codegen/codegen.go
@@ -102,7 +102,7 @@ func constructImportMapping(input map[string]string) importMap {
 // Uses the Go templating engine to generate all of our server wrappers from
 // the descriptions we've built up above from the schema objects.
 // opts defines
-func Generate(swagger *openapi3.Swagger, packageName string, opts Options) (string, error) {
+func Generate(swagger *openapi3.T, packageName string, opts Options) (string, error) {
 	importMapping = constructImportMapping(opts.ImportMapping)
 
 	filterOperationsByTag(swagger, opts)
@@ -268,7 +268,7 @@ func Generate(swagger *openapi3.Swagger, packageName string, opts Options) (stri
 	return string(outBytes), nil
 }
 
-func GenerateTypeDefinitions(t *template.Template, swagger *openapi3.Swagger, ops []OperationDefinition, excludeSchemas []string) (string, error) {
+func GenerateTypeDefinitions(t *template.Template, swagger *openapi3.T, ops []OperationDefinition, excludeSchemas []string) (string, error) {
 	schemaTypes, err := GenerateTypesForSchemas(t, swagger.Components.Schemas, excludeSchemas)
 	if err != nil {
 		return "", errors.Wrap(err, "error generating Go types for component schemas")
diff --git a/pkg/codegen/filter.go b/pkg/codegen/filter.go
index 61857d2..bf65b59 100644
--- a/pkg/codegen/filter.go
+++ b/pkg/codegen/filter.go
@@ -2,7 +2,7 @@ package codegen
 
 import "github.com/getkin/kin-openapi/openapi3"
 
-func filterOperationsByTag(swagger *openapi3.Swagger, opts Options) {
+func filterOperationsByTag(swagger *openapi3.T, opts Options) {
 	if len(opts.ExcludeTags) > 0 {
 		excludeOperationsWithTags(swagger.Paths, opts.ExcludeTags)
 	}
diff --git a/pkg/codegen/inline.go b/pkg/codegen/inline.go
index 6a5f5dd..a7ad034 100644
--- a/pkg/codegen/inline.go
+++ b/pkg/codegen/inline.go
@@ -26,7 +26,7 @@ import (
 
 // This generates a gzipped, base64 encoded JSON representation of the
 // swagger definition, which we embed inside the generated code.
-func GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger *openapi3.Swagger) (string, error) {
+func GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger *openapi3.T) (string, error) {
 	// Marshal to json
 	encoded, err := swagger.MarshalJSON()
 	if err != nil {
@@ -66,7 +66,7 @@ func GenerateInlinedSpec(t *template.Template, importMapping importMap, swagger
 	buf.Reset()
 	w := bufio.NewWriter(&buf)
 	err = t.ExecuteTemplate(w, "inline.tmpl", struct {
-		SpecParts      []string
+		SpecParts     []string
 		ImportMapping importMap
 	}{SpecParts: parts, ImportMapping: importMapping})
 	if err != nil {
diff --git a/pkg/codegen/operations.go b/pkg/codegen/operations.go
index cbfe2ed..45f92c0 100644
--- a/pkg/codegen/operations.go
+++ b/pkg/codegen/operations.go
@@ -375,7 +375,7 @@ func FilterParameterDefinitionByType(params []ParameterDefinition, in string) []
 }
 
 // OperationDefinitions returns all operations for a swagger definition.
-func OperationDefinitions(swagger *openapi3.Swagger) ([]OperationDefinition, error) {
+func OperationDefinitions(swagger *openapi3.T) ([]OperationDefinition, error) {
 	var operations []OperationDefinition
 
 	for _, requestPath := range SortedPathsKeys(swagger.Paths) {
diff --git a/pkg/codegen/prune.go b/pkg/codegen/prune.go
index a2804f0..73f4fb9 100644
--- a/pkg/codegen/prune.go
+++ b/pkg/codegen/prune.go
@@ -21,7 +21,7 @@ type RefWrapper struct {
 	SourceRef interface{}
 }
 
-func walkSwagger(swagger *openapi3.Swagger, doFn func(RefWrapper) (bool, error)) error {
+func walkSwagger(swagger *openapi3.T, doFn func(RefWrapper) (bool, error)) error {
 	if swagger == nil {
 		return nil
 	}
@@ -377,7 +377,7 @@ func walkExampleRef(ref *openapi3.ExampleRef, doFn func(RefWrapper) (bool, error
 	return nil
 }
 
-func findComponentRefs(swagger *openapi3.Swagger) []string {
+func findComponentRefs(swagger *openapi3.T) []string {
 	refs := []string{}
 
 	walkSwagger(swagger, func(ref RefWrapper) (bool, error) {
@@ -391,7 +391,7 @@ func findComponentRefs(swagger *openapi3.Swagger) []string {
 	return refs
 }
 
-func removeOrphanedComponents(swagger *openapi3.Swagger, refs []string) int {
+func removeOrphanedComponents(swagger *openapi3.T, refs []string) int {
 	countRemoved := 0
 
 	for key, _ := range swagger.Components.Schemas {
@@ -472,7 +472,7 @@ func removeOrphanedComponents(swagger *openapi3.Swagger, refs []string) int {
 	return countRemoved
 }
 
-func pruneUnusedComponents(swagger *openapi3.Swagger) {
+func pruneUnusedComponents(swagger *openapi3.T) {
 	for {
 		refs := findComponentRefs(swagger)
 		countRemoved := removeOrphanedComponents(swagger, refs)
diff --git a/pkg/codegen/templates/chi-middleware.tmpl b/pkg/codegen/templates/chi-middleware.tmpl
index db0f62d..e17684d 100644
--- a/pkg/codegen/templates/chi-middleware.tmpl
+++ b/pkg/codegen/templates/chi-middleware.tmpl
@@ -101,7 +101,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
         {{end}}
 
         {{if .IsStyled}}
-          err = runtime.BindStyledParameter("{{.Style}}",{{.Explode}}, "{{.ParamName}}", valueList[0], &{{.GoName}})
+          err = runtime.BindStyledParameterWithLocation("{{.Style}}",{{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, valueList[0], &{{.GoName}})
           if err != nil {
             http.Error(w, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err), http.StatusBadRequest)
             return
diff --git a/pkg/codegen/templates/inline.tmpl b/pkg/codegen/templates/inline.tmpl
index 26de489..106a42b 100644
--- a/pkg/codegen/templates/inline.tmpl
+++ b/pkg/codegen/templates/inline.tmpl
@@ -59,12 +59,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
     var resolvePath = PathToRawSpec("")
 
-    loader := openapi3.NewSwaggerLoader()
+    loader := openapi3.NewLoader()
     loader.IsExternalRefsAllowed = true
-    loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+    loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
         var pathToFile = url.String()
         pathToFile = path.Clean(pathToFile)
         getSpec, ok := resolvePath[pathToFile]
@@ -79,7 +79,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
     if err != nil {
         return
     }
-    swagger, err = loader.LoadSwaggerFromData(specData)
+    swagger, err = loader.LoadFromData(specData)
     if err != nil {
         return
     }
diff --git a/pkg/codegen/templates/templates.gen.go b/pkg/codegen/templates/templates.gen.go
index 1280d49..5f1d8a3 100644
--- a/pkg/codegen/templates/templates.gen.go
+++ b/pkg/codegen/templates/templates.gen.go
@@ -228,7 +228,7 @@ func (siw *ServerInterfaceWrapper) {{$opid}}(w http.ResponseWriter, r *http.Requ
         {{end}}
 
         {{if .IsStyled}}
-          err = runtime.BindStyledParameter("{{.Style}}",{{.Explode}}, "{{.ParamName}}", valueList[0], &{{.GoName}})
+          err = runtime.BindStyledParameterWithLocation("{{.Style}}",{{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, valueList[0], &{{.GoName}})
           if err != nil {
             http.Error(w, fmt.Sprintf("Invalid format for parameter {{.ParamName}}: %s", err), http.StatusBadRequest)
             return
@@ -820,12 +820,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
     var resolvePath = PathToRawSpec("")
 
-    loader := openapi3.NewSwaggerLoader()
+    loader := openapi3.NewLoader()
     loader.IsExternalRefsAllowed = true
-    loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+    loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
         var pathToFile = url.String()
         pathToFile = path.Clean(pathToFile)
         getSpec, ok := resolvePath[pathToFile]
@@ -840,7 +840,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
     if err != nil {
         return
     }
-    swagger, err = loader.LoadSwaggerFromData(specData)
+    swagger, err = loader.LoadFromData(specData)
     if err != nil {
         return
     }
diff --git a/pkg/middleware/oapi_validate.go b/pkg/middleware/oapi_validate.go
index 85ce636..cbed69a 100644
--- a/pkg/middleware/oapi_validate.go
+++ b/pkg/middleware/oapi_validate.go
@@ -43,7 +43,7 @@ func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error) {
 		return nil, fmt.Errorf("error reading %s: %s", path, err)
 	}
 
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData(data)
+	swagger, err := openapi3.NewLoader().LoadFromData(data)
 	if err != nil {
 		return nil, fmt.Errorf("error parsing %s as Swagger YAML: %s",
 			path, err)
@@ -52,7 +52,7 @@ func OapiValidatorFromYamlFile(path string) (echo.MiddlewareFunc, error) {
 }
 
 // Create a validator from a swagger object.
-func OapiRequestValidator(swagger *openapi3.Swagger) echo.MiddlewareFunc {
+func OapiRequestValidator(swagger *openapi3.T) echo.MiddlewareFunc {
 	return OapiRequestValidatorWithOptions(swagger, nil)
 }
 
@@ -66,7 +66,7 @@ type Options struct {
 }
 
 // Create a validator from a swagger object, with validation options
-func OapiRequestValidatorWithOptions(swagger *openapi3.Swagger, options *Options) echo.MiddlewareFunc {
+func OapiRequestValidatorWithOptions(swagger *openapi3.T, options *Options) echo.MiddlewareFunc {
 	router, err := legacy.NewRouter(swagger)
 	if err != nil {
 		panic(err)
diff --git a/pkg/util/loader.go b/pkg/util/loader.go
index 4825620..9efbb8f 100644
--- a/pkg/util/loader.go
+++ b/pkg/util/loader.go
@@ -6,15 +6,15 @@ import (
 	"github.com/getkin/kin-openapi/openapi3"
 )
 
-func LoadSwagger(filePath string) (swagger *openapi3.Swagger, err error) {
+func LoadSwagger(filePath string) (swagger *openapi3.T, err error) {
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
 
 	u, err := url.Parse(filePath)
 	if err == nil && u.Scheme != "" && u.Host != "" {
-		return loader.LoadSwaggerFromURI(u)
+		return loader.LoadFromURI(u)
 	} else {
-		return loader.LoadSwaggerFromFile(filePath)
+		return loader.LoadFromFile(filePath)
 	}
 }


Test patch:
diff --git a/internal/test/client/client.gen.go b/internal/test/client/client.gen.go
index 399698b..8761f0b 100644
--- a/internal/test/client/client.gen.go
+++ b/internal/test/client/client.gen.go
@@ -1089,12 +1089,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -1109,7 +1109,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/components/components.gen.go b/internal/test/components/components.gen.go
index 94beba2..1224c53 100644
--- a/internal/test/components/components.gen.go
+++ b/internal/test/components/components.gen.go
@@ -1442,12 +1442,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -1462,7 +1462,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/externalref/externalref.gen.go b/internal/test/externalref/externalref.gen.go
index 0f63a4f..541ee97 100644
--- a/internal/test/externalref/externalref.gen.go
+++ b/internal/test/externalref/externalref.gen.go
@@ -90,12 +90,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -110,7 +110,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/externalref/packageA/externalref.gen.go b/internal/test/externalref/packageA/externalref.gen.go
index 7062f88..8096440 100644
--- a/internal/test/externalref/packageA/externalref.gen.go
+++ b/internal/test/externalref/packageA/externalref.gen.go
@@ -83,12 +83,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -103,7 +103,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/externalref/packageB/externalref.gen.go b/internal/test/externalref/packageB/externalref.gen.go
index 327c238..f326925 100644
--- a/internal/test/externalref/packageB/externalref.gen.go
+++ b/internal/test/externalref/packageB/externalref.gen.go
@@ -72,12 +72,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -92,7 +92,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/issues/issue-312/issue.gen.go b/internal/test/issues/issue-312/issue.gen.go
index 2d834b1..dfcf042 100644
--- a/internal/test/issues/issue-312/issue.gen.go
+++ b/internal/test/issues/issue-312/issue.gen.go
@@ -558,12 +558,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -578,7 +578,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/issues/issue-52/issue.gen.go b/internal/test/issues/issue-52/issue.gen.go
index 4921ab5..1e0ff43 100644
--- a/internal/test/issues/issue-52/issue.gen.go
+++ b/internal/test/issues/issue-52/issue.gen.go
@@ -422,12 +422,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -442,7 +442,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/issues/issue-52/issue_test.go b/internal/test/issues/issue-52/issue_test.go
index b6b1555..e549443 100644
--- a/internal/test/issues/issue-52/issue_test.go
+++ b/internal/test/issues/issue-52/issue_test.go
@@ -50,7 +50,7 @@ components:
 `
 
 func TestIssue(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(spec))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(spec))
 	require.NoError(t, err)
 
 	opts := codegen.Options{
diff --git a/internal/test/issues/issue-grab_import_names/issue.gen.go b/internal/test/issues/issue-grab_import_names/issue.gen.go
index dbef99d..3075bf4 100644
--- a/internal/test/issues/issue-grab_import_names/issue.gen.go
+++ b/internal/test/issues/issue-grab_import_names/issue.gen.go
@@ -417,12 +417,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -437,7 +437,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/issues/issue-grab_import_names/issue_test.go b/internal/test/issues/issue-grab_import_names/issue_test.go
index eeda4cc..705ae82 100644
--- a/internal/test/issues/issue-grab_import_names/issue_test.go
+++ b/internal/test/issues/issue-grab_import_names/issue_test.go
@@ -9,7 +9,7 @@ import (
 )
 
 func TestLineComments(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromFile("spec.yaml")
+	swagger, err := openapi3.NewLoader().LoadFromFile("spec.yaml")
 	require.NoError(t, err)
 
 	opts := codegen.Options{
diff --git a/internal/test/issues/issue-illegal_enum_names/issue.gen.go b/internal/test/issues/issue-illegal_enum_names/issue.gen.go
index cf2787f..dafadfb 100644
--- a/internal/test/issues/issue-illegal_enum_names/issue.gen.go
+++ b/internal/test/issues/issue-illegal_enum_names/issue.gen.go
@@ -370,12 +370,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -390,7 +390,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/issues/issue-illegal_enum_names/issue_test.go b/internal/test/issues/issue-illegal_enum_names/issue_test.go
index 617defb..f869f0e 100644
--- a/internal/test/issues/issue-illegal_enum_names/issue_test.go
+++ b/internal/test/issues/issue-illegal_enum_names/issue_test.go
@@ -12,7 +12,7 @@ import (
 )
 
 func TestIllegalEnumNames(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromFile("spec.yaml")
+	swagger, err := openapi3.NewLoader().LoadFromFile("spec.yaml")
 	require.NoError(t, err)
 
 	opts := codegen.Options{
diff --git a/internal/test/parameters/parameters.gen.go b/internal/test/parameters/parameters.gen.go
index 474f94a..cc3425d 100644
--- a/internal/test/parameters/parameters.gen.go
+++ b/internal/test/parameters/parameters.gen.go
@@ -3180,12 +3180,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -3200,7 +3200,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/schemas/schemas.gen.go b/internal/test/schemas/schemas.gen.go
index fbb6b9e..0e27715 100644
--- a/internal/test/schemas/schemas.gen.go
+++ b/internal/test/schemas/schemas.gen.go
@@ -1267,12 +1267,12 @@ func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
 // The logic of resolving external references is tightly connected to "import-mapping" feature.
 // Externally referenced files must be embedded in the corresponding golang packages.
 // Urls can be supported but this task was out of the scope.
-func GetSwagger() (swagger *openapi3.Swagger, err error) {
+func GetSwagger() (swagger *openapi3.T, err error) {
 	var resolvePath = PathToRawSpec("")
 
-	loader := openapi3.NewSwaggerLoader()
+	loader := openapi3.NewLoader()
 	loader.IsExternalRefsAllowed = true
-	loader.ReadFromURIFunc = func(loader *openapi3.SwaggerLoader, url *url.URL) ([]byte, error) {
+	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
 		var pathToFile = url.String()
 		pathToFile = path.Clean(pathToFile)
 		getSpec, ok := resolvePath[pathToFile]
@@ -1287,7 +1287,7 @@ func GetSwagger() (swagger *openapi3.Swagger, err error) {
 	if err != nil {
 		return
 	}
-	swagger, err = loader.LoadSwaggerFromData(specData)
+	swagger, err = loader.LoadFromData(specData)
 	if err != nil {
 		return
 	}
diff --git a/internal/test/server/server.gen.go b/internal/test/server/server.gen.go
index 1b7f034..53b527d 100644
--- a/internal/test/server/server.gen.go
+++ b/internal/test/server/server.gen.go
@@ -247,7 +247,7 @@ func (siw *ServerInterfaceWrapper) GetWithArgs(w http.ResponseWriter, r *http.Re
 			return
 		}
 
-		err = runtime.BindStyledParameter("simple", false, "header_argument", valueList[0], &HeaderArgument)
+		err = runtime.BindStyledParameterWithLocation("simple", false, "header_argument", runtime.ParamLocationHeader, valueList[0], &HeaderArgument)
 		if err != nil {
 			http.Error(w, fmt.Sprintf("Invalid format for parameter header_argument: %s", err), http.StatusBadRequest)
 			return
diff --git a/pkg/chi-middleware/oapi_validate_test.go b/pkg/chi-middleware/oapi_validate_test.go
index e16bd8b..6e2c10f 100644
--- a/pkg/chi-middleware/oapi_validate_test.go
+++ b/pkg/chi-middleware/oapi_validate_test.go
@@ -102,7 +102,7 @@ func doPost(t *testing.T, mux *chi.Mux, url string, jsonBody interface{}) *httpt
 }
 
 func TestOapiRequestValidator(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testSchema))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(testSchema))
 	require.NoError(t, err, "Error initializing swagger")
 
 	r := chi.NewRouter()
@@ -115,7 +115,7 @@ func TestOapiRequestValidator(t *testing.T) {
 }
 
 func TestOapiRequestValidatorWithOptions(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testSchema))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(testSchema))
 	require.NoError(t, err, "Error initializing swagger")
 
 	r := chi.NewRouter()
diff --git a/pkg/codegen/codegen_test.go b/pkg/codegen/codegen_test.go
index f0639a2..7096dbe 100644
--- a/pkg/codegen/codegen_test.go
+++ b/pkg/codegen/codegen_test.go
@@ -122,7 +122,7 @@ func TestExampleOpenAPICodeGeneration(t *testing.T) {
 	}
 
 	// Get a spec from the test definition in this file:
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testOpenAPIDefinition))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(testOpenAPIDefinition))
 	assert.NoError(t, err)
 
 	// Run our code generation:
diff --git a/pkg/codegen/filter_test.go b/pkg/codegen/filter_test.go
index 66db4c9..1342493 100644
--- a/pkg/codegen/filter_test.go
+++ b/pkg/codegen/filter_test.go
@@ -19,7 +19,7 @@ func TestFilterOperationsByTag(t *testing.T) {
 		}
 
 		// Get a spec from the test definition in this file:
-		swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testOpenAPIDefinition))
+		swagger, err := openapi3.NewLoader().LoadFromData([]byte(testOpenAPIDefinition))
 		assert.NoError(t, err)
 
 		// Run our code generation:
@@ -40,7 +40,7 @@ func TestFilterOperationsByTag(t *testing.T) {
 		}
 
 		// Get a spec from the test definition in this file:
-		swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testOpenAPIDefinition))
+		swagger, err := openapi3.NewLoader().LoadFromData([]byte(testOpenAPIDefinition))
 		assert.NoError(t, err)
 
 		// Run our code generation:
diff --git a/pkg/codegen/prune_test.go b/pkg/codegen/prune_test.go
index a358126..86437c2 100644
--- a/pkg/codegen/prune_test.go
+++ b/pkg/codegen/prune_test.go
@@ -9,14 +9,14 @@ import (
 
 func TestFindReferences(t *testing.T) {
 	t.Run("unfiltered", func(t *testing.T) {
-		swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneSpecTestFixture))
+		swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneSpecTestFixture))
 		assert.NoError(t, err)
 
 		refs := findComponentRefs(swagger)
 		assert.Len(t, refs, 14)
 	})
 	t.Run("only cat", func(t *testing.T) {
-		swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneSpecTestFixture))
+		swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneSpecTestFixture))
 		assert.NoError(t, err)
 		opts := Options{
 			IncludeTags: []string{"cat"},
@@ -28,7 +28,7 @@ func TestFindReferences(t *testing.T) {
 		assert.Len(t, refs, 7)
 	})
 	t.Run("only dog", func(t *testing.T) {
-		swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneSpecTestFixture))
+		swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneSpecTestFixture))
 		assert.NoError(t, err)
 
 		opts := Options{
@@ -44,7 +44,7 @@ func TestFindReferences(t *testing.T) {
 
 func TestFilterOnlyCat(t *testing.T) {
 	// Get a spec from the test definition in this file:
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneSpecTestFixture))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneSpecTestFixture))
 	assert.NoError(t, err)
 
 	opts := Options{
@@ -72,7 +72,7 @@ func TestFilterOnlyCat(t *testing.T) {
 
 func TestFilterOnlyDog(t *testing.T) {
 	// Get a spec from the test definition in this file:
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneSpecTestFixture))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneSpecTestFixture))
 	assert.NoError(t, err)
 
 	opts := Options{
@@ -100,7 +100,7 @@ func TestFilterOnlyDog(t *testing.T) {
 
 func TestPruningUnusedComponents(t *testing.T) {
 	// Get a spec from the test definition in this file:
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(pruneComprehensiveTestFixture))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(pruneComprehensiveTestFixture))
 	assert.NoError(t, err)
 
 	assert.Len(t, swagger.Components.Schemas, 8)
diff --git a/pkg/middleware/oapi_validate_test.go b/pkg/middleware/oapi_validate_test.go
index b5952c4..f63793d 100644
--- a/pkg/middleware/oapi_validate_test.go
+++ b/pkg/middleware/oapi_validate_test.go
@@ -117,7 +117,7 @@ func doPost(t *testing.T, e *echo.Echo, url string, jsonBody interface{}) *httpt
 }
 
 func TestOapiRequestValidator(t *testing.T) {
-	swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData([]byte(testSchema))
+	swagger, err := openapi3.NewLoader().LoadFromData([]byte(testSchema))
 	require.NoError(t, err, "Error initializing swagger")
 
 	// Create a new echo router