Repository: deepmap/oapi-codegen (go)

Issue:
Non-deterministic ordering security scheme provider constants
Currently the the order of security scheme providers constants is not deterministic (e.g. as in the generated code snippet below). This is because the order is determined by iterating over a map, which is deliberately randomized in Go.
```
const (
	TokenAuthScopes = "TokenAuth.Scopes"
	BasicAuthScopes = "BasicAuth.Scopes"
	JWTAuthScopes   = "JWTAuth.Scopes"
)
```

We currently check for changes to the generated files to determine whether additional steps are needed in our CI workflow. This non-deterministic behaviour is causing frequent false positives in our api change detection, which unnecessarily interrupts our CI workflow.

I've created a fix for this issue.

Pull request:
Sort security scheme provider names
This fixes #310 by ensuring that the generated constants are output in a deterministic (alphabetical) order.

Patch:
diff --git a/README.md b/README.md
index f04b3aa..6ed40f4 100644
--- a/README.md
+++ b/README.md
@@ -127,6 +127,8 @@ There are a few ways of registering your http handler based on the type of serve
 
 <details><summary><code>Echo</code></summary>
 
+Code generated using `-generate server`.
+
 The usage of `Echo` is out of scope of this doc, but once you have an
 echo instance, we generate a utility function to help you associate your handlers
 with this autogenerated code. For the pet store, it looks like this:
@@ -159,6 +161,8 @@ func SetupHandler() {
 
 <details><summary><code>Chi</code></summary>
 
+Code generated using `-generate chi-server`.
+
 ```go
 type PetStoreImpl struct {}
 func (*PetStoreImpl) GetPets(r *http.Request, w *http.ResponseWriter) {
@@ -176,6 +180,8 @@ func SetupHandler() {
 
 <details><summary><code>net/http</code></summary>
 
+[Chi](https://github.com/go-chi/chi) is 100% compatible with `net/http` allowing the following with code generated using `-generate chi-server`.
+
 ```go
 type PetStoreImpl struct {}
 func (*PetStoreImpl) GetPets(r *http.Request, w *http.ResponseWriter) {
diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go
index a95657f..3ccce8d 100644
--- a/examples/petstore-expanded/chi/api/petstore.gen.go
+++ b/examples/petstore-expanded/chi/api/petstore.gen.go
@@ -1,4 +1,4 @@
-// Package api provides primitives to interact the openapi HTTP API.
+// Package api provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package api
@@ -13,7 +13,7 @@ import (
 
 	"github.com/deepmap/oapi-codegen/pkg/runtime"
 	"github.com/getkin/kin-openapi/openapi3"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 )
 
 // Error defines model for Error.
diff --git a/examples/petstore-expanded/chi/petstore.go b/examples/petstore-expanded/chi/petstore.go
index e2b54a0..423950a 100644
--- a/examples/petstore-expanded/chi/petstore.go
+++ b/examples/petstore-expanded/chi/petstore.go
@@ -11,7 +11,7 @@ import (
 	"net/http"
 	"os"
 
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 
 	api "github.com/deepmap/oapi-codegen/examples/petstore-expanded/chi/api"
 	middleware "github.com/deepmap/oapi-codegen/pkg/chi-middleware"
diff --git a/examples/petstore-expanded/echo/api/petstore-server.gen.go b/examples/petstore-expanded/echo/api/petstore-server.gen.go
index baa05c6..5869830 100644
--- a/examples/petstore-expanded/echo/api/petstore-server.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-server.gen.go
@@ -1,4 +1,4 @@
-// Package api provides primitives to interact the openapi HTTP API.
+// Package api provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package api
diff --git a/examples/petstore-expanded/echo/api/petstore-types.gen.go b/examples/petstore-expanded/echo/api/petstore-types.gen.go
index c690051..7bfd7f1 100644
--- a/examples/petstore-expanded/echo/api/petstore-types.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-types.gen.go
@@ -1,4 +1,4 @@
-// Package api provides primitives to interact the openapi HTTP API.
+// Package api provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package api
diff --git a/examples/petstore-expanded/petstore-client.gen.go b/examples/petstore-expanded/petstore-client.gen.go
index d8be01f..22bb9f9 100644
--- a/examples/petstore-expanded/petstore-client.gen.go
+++ b/examples/petstore-expanded/petstore-client.gen.go
@@ -1,4 +1,4 @@
-// Package petstore provides primitives to interact the openapi HTTP API.
+// Package petstore provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package petstore
@@ -220,10 +220,7 @@ func NewFindPetsRequest(server string, params *FindPetsParams) (*http.Request, e
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	queryValues := queryUrl.Query()
 
@@ -294,10 +291,7 @@ func NewAddPetRequestWithBody(server string, contentType string, body io.Reader)
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("POST", queryUrl.String(), body)
 	if err != nil {
@@ -330,10 +324,7 @@ func NewDeletePetRequest(server string, id int64) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("DELETE", queryUrl.String(), nil)
 	if err != nil {
@@ -364,10 +355,7 @@ func NewFindPetByIdRequest(server string, id int64) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
diff --git a/go.mod b/go.mod
index 75ea6e3..6a180fe 100644
--- a/go.mod
+++ b/go.mod
@@ -3,9 +3,9 @@ module github.com/deepmap/oapi-codegen
 require (
 	github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c
 	github.com/getkin/kin-openapi v0.37.0
-	github.com/go-chi/chi v1.5.1
+	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.1.17
+	github.com/labstack/echo/v4 v4.2.1
 	github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd
 	github.com/mattn/go-colorable v0.1.8 // indirect
 	github.com/pkg/errors v0.8.1
@@ -14,6 +14,7 @@ require (
 	golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
 	golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
 	golang.org/x/text v0.3.5 // indirect
+	golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
 	golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f
 	gopkg.in/yaml.v2 v2.3.0
 )
diff --git a/go.sum b/go.sum
index c439a8c..797fd58 100644
--- a/go.sum
+++ b/go.sum
@@ -1,6 +1,5 @@
 github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c h1:/ovYnF02fwL0kvspmy9AuyKg1JhdTRUgPw4nUxd9oZM=
 github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
-github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 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=
@@ -10,8 +9,8 @@ github.com/getkin/kin-openapi v0.37.0 h1:nXIzVH5slhozZeKsmyPqM1fnTjHXKxilhaSN2Tc
 github.com/getkin/kin-openapi v0.37.0/go.mod h1:ZJSfy1PxJv2QQvH9EdBj3nupRTVvV42mkW6zKUlRBwk=
 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 v1.5.1 h1:kfTK3Cxd/dkMu/rKs5ZceWYp+t5CtiE7vmaTv3LjC6w=
-github.com/go-chi/chi v1.5.1/go.mod h1:REp24E+25iKvxgeTfHmdUoL5x15kBiDBlnIl5bCwe2k=
+github.com/go-chi/chi/v5 v5.0.0 h1:DBPx88FjZJH3FsICfDAfIfnb7XxKIYVGG6lOPlhENAg=
+github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
 github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
 github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
 github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY=
@@ -20,11 +19,11 @@ github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219 h1:utua3L2IbQJmauC
 github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y=
 github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
 github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
 github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
 github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
-github.com/labstack/echo/v4 v4.1.17/go.mod h1:Tn2yRQL/UclUalpb5rPdXDevbkJ+lp/2svdyFBg6CHQ=
+github.com/labstack/echo/v4 v4.2.1 h1:LF5Iq7t/jrtUuSutNuiEWtB5eiHfZ5gSe2pcu5exjQw=
+github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg=
 github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0=
 github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k=
 github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
@@ -32,30 +31,27 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq
 github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
 github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd h1:HvFwW+cm9bCbZ/+vuGNq7CRWXql8c0y8nGeYpqmpvmk=
 github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ=
-github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
 github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
 github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
 github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
 github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
-github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
 github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
 github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
+github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
 github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
 github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
 github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
-github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
 github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
 github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
-github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
 github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
+github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=
 github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
 golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
 golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -63,13 +59,10 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh
 golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY=
 golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
 golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwLmSJpwZ1yqXm8j0v2QI=
 golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
 golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
 golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew=
 golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU=
 golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -89,17 +82,16 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ=
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc=
+golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
+golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE=
+golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
 golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f h1:kDxGY2VmgABOe55qheT/TFqUMtcTHnomIPS1iv3G4Ms=
 golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7 h1:9zdDQZ7Thm29KFXgAX/+yaf3eVbP7djjWp/dXAppNCc=
 golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
 gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
-gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
 gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
 gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/pkg/codegen/codegen.go b/pkg/codegen/codegen.go
index 157f793..9b9b700 100644
--- a/pkg/codegen/codegen.go
+++ b/pkg/codegen/codegen.go
@@ -320,15 +320,22 @@ func GenerateConstants(t *template.Template, ops []OperationDefinition) (string,
 		SecuritySchemeProviderNames: []string{},
 	}
 
-	providerNames := map[string]struct{}{}
+	providerNameMap := map[string]struct{}{}
 	for _, op := range ops {
 		for _, def := range op.SecurityDefinitions {
 			providerName := SanitizeGoIdentity(def.ProviderName)
-			providerNames[providerName] = struct{}{}
+			providerNameMap[providerName] = struct{}{}
 		}
 	}
 
-	for providerName := range providerNames {
+	var providerNames []string
+	for providerName := range providerNameMap {
+		providerNames = append(providerNames, providerName)
+	}
+
+	sort.Strings(providerNames)
+
+	for _, providerName := range providerNames {
 		constants.SecuritySchemeProviderNames = append(constants.SecuritySchemeProviderNames, providerName)
 	}
 
diff --git a/pkg/codegen/templates/client.tmpl b/pkg/codegen/templates/client.tmpl
index 1ec2949..f02c617 100644
--- a/pkg/codegen/templates/client.tmpl
+++ b/pkg/codegen/templates/client.tmpl
@@ -168,10 +168,8 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
         basePath = basePath[1:]
     }
 
-    queryUrl, err = queryUrl.Parse(basePath)
-    if err != nil {
-        return nil, err
-    }
+    queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
+
 {{if .QueryParams}}
     queryValues := queryUrl.Query()
 {{range $paramIdx, $param := .QueryParams}}
diff --git a/pkg/codegen/templates/imports.tmpl b/pkg/codegen/templates/imports.tmpl
index db72905..55505fe 100644
--- a/pkg/codegen/templates/imports.tmpl
+++ b/pkg/codegen/templates/imports.tmpl
@@ -1,4 +1,4 @@
-// Package {{.PackageName}} provides primitives to interact the openapi HTTP API.
+// Package {{.PackageName}} provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package {{.PackageName}}
@@ -23,7 +23,7 @@ import (
 	"github.com/deepmap/oapi-codegen/pkg/runtime"
 	openapi_types "github.com/deepmap/oapi-codegen/pkg/types"
 	"github.com/getkin/kin-openapi/openapi3"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	"github.com/labstack/echo/v4"
 	"github.com/pkg/errors"
 	{{- range .ExternalImports}}
diff --git a/pkg/codegen/templates/templates.gen.go b/pkg/codegen/templates/templates.gen.go
index 36f8530..4943e72 100644
--- a/pkg/codegen/templates/templates.gen.go
+++ b/pkg/codegen/templates/templates.gen.go
@@ -593,10 +593,8 @@ func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamAr
         basePath = basePath[1:]
     }
 
-    queryUrl, err = queryUrl.Parse(basePath)
-    if err != nil {
-        return nil, err
-    }
+    queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
+
 {{if .QueryParams}}
     queryValues := queryUrl.Query()
 {{range $paramIdx, $param := .QueryParams}}
@@ -714,7 +712,7 @@ const (
 )
 {{end}}
 `,
-	"imports.tmpl": `// Package {{.PackageName}} provides primitives to interact the openapi HTTP API.
+	"imports.tmpl": `// Package {{.PackageName}} provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package {{.PackageName}}
@@ -739,7 +737,7 @@ import (
 	"github.com/deepmap/oapi-codegen/pkg/runtime"
 	openapi_types "github.com/deepmap/oapi-codegen/pkg/types"
 	"github.com/getkin/kin-openapi/openapi3"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	"github.com/labstack/echo/v4"
 	"github.com/pkg/errors"
 	{{- range .ExternalImports}}
diff --git a/pkg/runtime/styleparam.go b/pkg/runtime/styleparam.go
index 638e834..bc5b74c 100644
--- a/pkg/runtime/styleparam.go
+++ b/pkg/runtime/styleparam.go
@@ -335,8 +335,10 @@ func primitiveToString(value interface{}) (string, error) {
 	switch kind {
 	case reflect.Int8, reflect.Int32, reflect.Int64, reflect.Int:
 		output = strconv.FormatInt(v.Int(), 10)
-	case reflect.Float32, reflect.Float64:
+	case reflect.Float64:
 		output = strconv.FormatFloat(v.Float(), 'f', -1, 64)
+	case reflect.Float32:
+		output = strconv.FormatFloat(v.Float(), 'f', -1, 32)
 	case reflect.Bool:
 		if v.Bool() {
 			output = "true"


Test patch:
diff --git a/examples/petstore-expanded/chi/petstore_test.go b/examples/petstore-expanded/chi/petstore_test.go
index a4823c3..71c9613 100644
--- a/examples/petstore-expanded/chi/petstore_test.go
+++ b/examples/petstore-expanded/chi/petstore_test.go
@@ -7,7 +7,7 @@ import (
 	"net/http/httptest"
 	"testing"
 
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 
diff --git a/internal/test/client/client.gen.go b/internal/test/client/client.gen.go
index 9956ae1..bdbc122 100644
--- a/internal/test/client/client.gen.go
+++ b/internal/test/client/client.gen.go
@@ -1,4 +1,4 @@
-// Package client provides primitives to interact the openapi HTTP API.
+// Package client provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package client
@@ -265,10 +265,7 @@ func NewPostBothRequestWithBody(server string, contentType string, body io.Reade
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("POST", queryUrl.String(), body)
 	if err != nil {
@@ -294,10 +291,7 @@ func NewGetBothRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -332,10 +326,7 @@ func NewPostJsonRequestWithBody(server string, contentType string, body io.Reade
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("POST", queryUrl.String(), body)
 	if err != nil {
@@ -361,10 +352,7 @@ func NewGetJsonRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -388,10 +376,7 @@ func NewPostOtherRequestWithBody(server string, contentType string, body io.Read
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("POST", queryUrl.String(), body)
 	if err != nil {
@@ -417,10 +402,7 @@ func NewGetOtherRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -444,10 +426,7 @@ func NewGetJsonWithTrailingSlashRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
diff --git a/internal/test/components/components.gen.go b/internal/test/components/components.gen.go
index a75d8bb..c94bf8a 100644
--- a/internal/test/components/components.gen.go
+++ b/internal/test/components/components.gen.go
@@ -1,4 +1,4 @@
-// Package components provides primitives to interact the openapi HTTP API.
+// Package components provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package components
@@ -887,10 +887,7 @@ func NewEnsureEverythingIsReferencedRequestWithBody(server string, contentType s
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), body)
 	if err != nil {
@@ -916,10 +913,7 @@ func NewParamsWithAddPropsRequest(server string, params *ParamsWithAddPropsParam
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	queryValues := queryUrl.Query()
 
@@ -982,10 +976,7 @@ func NewBodyWithAddPropsRequestWithBody(server string, contentType string, body
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("POST", queryUrl.String(), body)
 	if err != nil {
diff --git a/internal/test/externalref/externalref.gen.go b/internal/test/externalref/externalref.gen.go
index 5fc09bd..39eaf37 100644
--- a/internal/test/externalref/externalref.gen.go
+++ b/internal/test/externalref/externalref.gen.go
@@ -1,4 +1,4 @@
-// Package externalref provides primitives to interact the openapi HTTP API.
+// Package externalref provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package externalref
diff --git a/internal/test/externalref/packageA/externalref.gen.go b/internal/test/externalref/packageA/externalref.gen.go
index 066f2b7..a3d1e0b 100644
--- a/internal/test/externalref/packageA/externalref.gen.go
+++ b/internal/test/externalref/packageA/externalref.gen.go
@@ -1,4 +1,4 @@
-// Package packageA provides primitives to interact the openapi HTTP API.
+// Package packageA provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package packageA
diff --git a/internal/test/externalref/packageB/externalref.gen.go b/internal/test/externalref/packageB/externalref.gen.go
index 831b7e8..5736e7c 100644
--- a/internal/test/externalref/packageB/externalref.gen.go
+++ b/internal/test/externalref/packageB/externalref.gen.go
@@ -1,4 +1,4 @@
-// Package packageB provides primitives to interact the openapi HTTP API.
+// Package packageB provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package packageB
diff --git a/internal/test/issues/issue-52/issue.gen.go b/internal/test/issues/issue-52/issue.gen.go
index 6678357..05690d6 100644
--- a/internal/test/issues/issue-52/issue.gen.go
+++ b/internal/test/issues/issue-52/issue.gen.go
@@ -1,4 +1,4 @@
-// Package issue_52 provides primitives to interact the openapi HTTP API.
+// Package issue_52 provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package issue_52
@@ -194,10 +194,7 @@ func NewExampleGetRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
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 5dd8730..7f1dc5e 100644
--- a/internal/test/issues/issue-grab_import_names/issue.gen.go
+++ b/internal/test/issues/issue-grab_import_names/issue.gen.go
@@ -1,4 +1,4 @@
-// Package grab_import_names provides primitives to interact the openapi HTTP API.
+// Package grab_import_names provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package grab_import_names
@@ -132,10 +132,7 @@ func NewGetFooRequest(server string, params *GetFooParams) (*http.Request, error
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
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 76e553a..70c4d94 100644
--- a/internal/test/issues/issue-illegal_enum_names/issue.gen.go
+++ b/internal/test/issues/issue-illegal_enum_names/issue.gen.go
@@ -1,4 +1,4 @@
-// Package illegal_enum_names provides primitives to interact the openapi HTTP API.
+// Package illegal_enum_names provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package illegal_enum_names
@@ -136,10 +136,7 @@ func NewGetFooRequest(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
diff --git a/internal/test/parameters/parameters.gen.go b/internal/test/parameters/parameters.gen.go
index a67d149..6299abc 100644
--- a/internal/test/parameters/parameters.gen.go
+++ b/internal/test/parameters/parameters.gen.go
@@ -1,4 +1,4 @@
-// Package parameters provides primitives to interact the openapi HTTP API.
+// Package parameters provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package parameters
@@ -481,10 +481,7 @@ func NewGetContentObjectRequest(server string, param ComplexObject) (*http.Reque
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -508,10 +505,7 @@ func NewGetCookieRequest(server string, params *GetCookieParams) (*http.Request,
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -642,10 +636,7 @@ func NewGetHeaderRequest(server string, params *GetHeaderParams) (*http.Request,
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -755,10 +746,7 @@ func NewGetLabelExplodeArrayRequest(server string, param []int32) (*http.Request
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -789,10 +777,7 @@ func NewGetLabelExplodeObjectRequest(server string, param Object) (*http.Request
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -823,10 +808,7 @@ func NewGetLabelNoExplodeArrayRequest(server string, param []int32) (*http.Reque
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -857,10 +839,7 @@ func NewGetLabelNoExplodeObjectRequest(server string, param Object) (*http.Reque
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -891,10 +870,7 @@ func NewGetMatrixExplodeArrayRequest(server string, id []int32) (*http.Request,
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -925,10 +901,7 @@ func NewGetMatrixExplodeObjectRequest(server string, id Object) (*http.Request,
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -959,10 +932,7 @@ func NewGetMatrixNoExplodeArrayRequest(server string, id []int32) (*http.Request
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -993,10 +963,7 @@ func NewGetMatrixNoExplodeObjectRequest(server string, id Object) (*http.Request
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1024,10 +991,7 @@ func NewGetPassThroughRequest(server string, param string) (*http.Request, error
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1051,10 +1015,7 @@ func NewGetDeepObjectRequest(server string, params *GetDeepObjectParams) (*http.
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	queryValues := queryUrl.Query()
 
@@ -1094,10 +1055,7 @@ func NewGetQueryFormRequest(server string, params *GetQueryFormParams) (*http.Re
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	queryValues := queryUrl.Query()
 
@@ -1254,10 +1212,7 @@ func NewGetSimpleExplodeArrayRequest(server string, param []int32) (*http.Reques
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1288,10 +1243,7 @@ func NewGetSimpleExplodeObjectRequest(server string, param Object) (*http.Reques
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1322,10 +1274,7 @@ func NewGetSimpleNoExplodeArrayRequest(server string, param []int32) (*http.Requ
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1356,10 +1305,7 @@ func NewGetSimpleNoExplodeObjectRequest(server string, param Object) (*http.Requ
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -1390,10 +1336,7 @@ func NewGetSimplePrimitiveRequest(server string, param int32) (*http.Request, er
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
diff --git a/internal/test/schemas/schemas.gen.go b/internal/test/schemas/schemas.gen.go
index ae222b0..8a3bbb3 100644
--- a/internal/test/schemas/schemas.gen.go
+++ b/internal/test/schemas/schemas.gen.go
@@ -1,4 +1,4 @@
-// Package schemas provides primitives to interact the openapi HTTP API.
+// Package schemas provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package schemas
@@ -283,10 +283,7 @@ func NewEnsureEverythingIsReferencedRequest(server string) (*http.Request, error
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -310,10 +307,7 @@ func NewIssue127Request(server string) (*http.Request, error) {
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -348,10 +342,7 @@ func NewIssue185RequestWithBody(server string, contentType string, body io.Reade
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), body)
 	if err != nil {
@@ -384,10 +375,7 @@ func NewIssue209Request(server string, str StringInPath) (*http.Request, error)
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -418,10 +406,7 @@ func NewIssue30Request(server string, pFallthrough string) (*http.Request, error
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -452,10 +437,7 @@ func NewIssue41Request(server string, n1param N5StartsWithNumber) (*http.Request
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	req, err := http.NewRequest("GET", queryUrl.String(), nil)
 	if err != nil {
@@ -490,10 +472,7 @@ func NewIssue9RequestWithBody(server string, params *Issue9Params, contentType s
 		basePath = basePath[1:]
 	}
 
-	queryUrl, err = queryUrl.Parse(basePath)
-	if err != nil {
-		return nil, err
-	}
+	queryUrl = queryUrl.ResolveReference(&url.URL{Path: basePath})
 
 	queryValues := queryUrl.Query()
 
diff --git a/internal/test/server/server.gen.go b/internal/test/server/server.gen.go
index a64db8b..99ec2d0 100644
--- a/internal/test/server/server.gen.go
+++ b/internal/test/server/server.gen.go
@@ -1,4 +1,4 @@
-// Package server provides primitives to interact the openapi HTTP API.
+// Package server provides primitives to interact with the openapi HTTP API.
 //
 // Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
 package server
@@ -10,7 +10,7 @@ import (
 
 	"github.com/deepmap/oapi-codegen/pkg/runtime"
 	openapi_types "github.com/deepmap/oapi-codegen/pkg/types"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 )
 
 // EveryTypeOptional defines model for EveryTypeOptional.
diff --git a/pkg/chi-middleware/oapi_validate_test.go b/pkg/chi-middleware/oapi_validate_test.go
index c8e2c60..e16bd8b 100644
--- a/pkg/chi-middleware/oapi_validate_test.go
+++ b/pkg/chi-middleware/oapi_validate_test.go
@@ -10,7 +10,7 @@ import (
 	"github.com/deepmap/oapi-codegen/pkg/testutil"
 	"github.com/getkin/kin-openapi/openapi3"
 	"github.com/getkin/kin-openapi/openapi3filter"
-	"github.com/go-chi/chi"
+	"github.com/go-chi/chi/v5"
 	"github.com/stretchr/testify/assert"
 	"github.com/stretchr/testify/require"
 )
diff --git a/pkg/runtime/styleparam_test.go b/pkg/runtime/styleparam_test.go
index 0120cc9..14e4e5d 100644
--- a/pkg/runtime/styleparam_test.go
+++ b/pkg/runtime/styleparam_test.go
@@ -490,11 +490,16 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, "7", result)
 
-	type FloatType float64
-	result, err = StyleParam("simple", false, "foo", FloatType(7.5))
+	type FloatType64 float64
+	result, err = StyleParam("simple", false, "foo", FloatType64(7.5))
 	assert.NoError(t, err)
 	assert.EqualValues(t, "7.5", result)
 
+	type FloatType32 float32
+	result, err = StyleParam("simple", false, "foo", FloatType32(1.05))
+	assert.NoError(t, err)
+	assert.EqualValues(t, "1.05", result)
+
 	// Test that we handle optional fields
 	type TestObject2 struct {
 		FirstName *string `json:"firstName"`