Repository: deepmap/oapi-codegen (go)

Issue:
OAS 'date-time' type in query parameter causes panic in client
Using time (date-time) parameter in client causes the following panic when the parameter is set:

`panic: reflect.Value.Interface: cannot return value obtained from unexported field or method`

Example OAS spec:
```
paths:
  /test:
    description: Test API
    get:
      tags:
        - test
      summary: Get Test
      operationId: GetTest
      parameters:
        - in: query
          description: Timestamp
          name: ts
          schema:
            type: string
            format: 'date-time'
            description: Timestamp
```

Suggested fix in PR
#152 


Pull request description:
Fix time serialization panic (reflect.Value.Interface: cannot return value obtained from unexported field or method)
Fixes #153 

- Fix time serialization
  * For query parameter, time is stored as a direct reference
    (non-pointer) which was previously not supported and
    caused the panic:
    panic: reflect.Value.Interface: cannot return value obtained from unexported field or method
  * It should not be possible to serialize time alone as a
    deepObject, as it should be handled as primitive.
- Add tests for time serialization



Patch:
diff --git a/examples/petstore-expanded/chi/api/petstore.gen.go b/examples/petstore-expanded/chi/api/petstore.gen.go
index 01b6d78..d3c25c0 100644
--- a/examples/petstore-expanded/chi/api/petstore.gen.go
+++ b/examples/petstore-expanded/chi/api/petstore.gen.go
@@ -219,14 +219,14 @@ var swaggerSpec = []string{
 	"bgypVNJK2hdRD0oF7qtAi27P5f5J+7Qak10DcrBFrNGCZC7SjqUNC1IPP9RiCUhaN3CVD1WgnaJY8pS5",
 	"wRn9uw8I6paKzTy2hoIRAq40ZfKTWj38tY6hIXnVbVSP6uidI5Tu0HwAq9UiGVdO9hzTnswxNZlDNapZ",
 	"VGDg2B2hTIUbufAecFEMlqU6VqilIFTZ+2wSctzpjLS2Xw93p8I05iaMQybhGk4612ia2p34W1tv/0WP",
-	"OB0Z2nG3cGZufuDo9Hxpx0ZWAiiXNoOcHxaCK+37sGQvlOFha3QUMHPzWClvj+e8rjOnw8MSfaFumiHb",
-	"mCIU2qF0OVSNFzBn3Or/Itt2Duq00uadc0gBv3LQvl7DA2UdcDKV6qXhzO1w+wZIz4HldZS/Oa7u7jW+",
-	"DNp8Wjpvbm72cxHFcZ4bBj+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ger returns the Swagger specification corresponding to the generated code
diff --git a/examples/petstore-expanded/echo/api/petstore-server.gen.go b/examples/petstore-expanded/echo/api/petstore-server.gen.go
index 04aa1d4..109dd64 100644
--- a/examples/petstore-expanded/echo/api/petstore-server.gen.go
+++ b/examples/petstore-expanded/echo/api/petstore-server.gen.go
@@ -149,14 +149,14 @@ var swaggerSpec = []string{
 	"bgypVNJK2hdRD0oF7qtAi27P5f5J+7Qak10DcrBFrNGCZC7SjqUNC1IPP9RiCUhaN3CVD1WgnaJY8pS5",
 	"wRn9uw8I6paKzTy2hoIRAq40ZfKTWj38tY6hIXnVbVSP6uidI5Tu0HwAq9UiGVdO9hzTnswxNZlDNapZ",
 	"VGDg2B2hTIUbufAecFEMlqU6VqilIFTZ+2wSctzpjLS2Xw93p8I05iaMQybhGk4612ia2p34W1tv/0WP",
-	"OB0Z2nG3cGZufuDo9Hxpx0ZWAiiXNoOcHxaCK+37sGQvlOFha3QUMHPzWClvj+e8rjOnw8MSfaFumiHb",
-	"mCIU2qF0OVSNFzBn3Or/Itt2Duq00uadc0gBv3LQvl7DA2UdcDKV6qXhzO1w+wZIz4HldZS/Oa7u7jW+",
-	"DNp8Wjpvbm72cxHFcZ4bBj+NFrNfi2J+vsbDa8PeOOm9YGZ3MSENJLAHM85PS6xefhee12CMY/+VjWuk",
-	"r4M2X+3S45rOlBoC5u2VEUOxDalcGUbeZ0JpQ12kJ127n9ba5KOn9Ihdl+jA5316Indh53dO3TxJS0W+",
-	"T277L2NhP3lf0nBHoqZD5/TrAPvMYpIr7f5Jz/ymVf57rHEheLvfJtbZM7vdaBFPcuUFbbyusYXjyre3",
-	"GnhAbcRpdM3iFkrVnK545LZFjzZ5tectbrWpDKO2E5apoeiIfewn7C6U/lYvuf62ddlLvrvMWoGMKNx/",
-	"kpC3BzGaCltY3Cq81185zhU76Li4/dYB9f124X6XXksSu/63yfU/W8YvFB3Vb0sob/Yynb3p71/a+5NX",
-	"X31/3d3v/hEAAP//81bN0nkSAAA=",
+	"OB0Z2nG3cGZufuDo9Hxpx0ZWAiiXNoOcHxaCK+37sGQvlOFha3QUMHPzWClvj+e8rjPdNDK2qUQotDPo",
+	"coYaL2DOuNX/Rbbt2NPhpI035wgCfuWgbbyGB8o6z2Qq1UuDldtZ9g1MngPLGajfHEZ39zoAlUFbS0P/",
+	"5uZmP/VQHKe1YfDT4DD7tSjE52tpvzbKjXPcCyJ2F/PPQAJ7MON0tMTq5XfheQ3GONRf2bhG+jpoa9Ue",
+	"PK7pTKkhYN5eGSAU25DKlVHjfSaUNrJFetK1+1mszTV6Bo/YdYmOc96nJ3IXZn3n1KtmnE2pyPfJbf9l",
+	"LOzn6ksa7kjUY+icfh1gm9MZWXKl3T/pmd+0yn+PNS4Eb/fbPDp7ZrcbLeJJrrx+jdc1tnBc+fbOAg+o",
+	"bTaNrlncQqma0xWP3Lbo0SavdrTFrfaQYdR2wjL1Dx2gj+2D3YXS3+ol19+lLnvJd5dZK5ARhftPEvL2",
+	"IEZTYQuLW4X3+gvFuWIHHRe33zp+vt8u3O/Sa0li1/82uf5ny/iFoqP6bQnlzV6ms/f4/St5f/Jiq2+n",
+	"u/vdPwIAAP//v4qmX1cSAAA=",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/go.mod b/go.mod
index 0fc8360..758e100 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.2.0
+	github.com/getkin/kin-openapi v0.3.0
 	github.com/go-chi/chi v4.0.2+incompatible
 	github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219
 	github.com/labstack/echo/v4 v4.1.11
@@ -17,7 +17,7 @@ require (
 	golang.org/x/sys v0.0.0-20191115151921-52ab43148777 // indirect
 	golang.org/x/text v0.3.2 // indirect
 	golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f // indirect
-	gopkg.in/yaml.v2 v2.2.5
+	gopkg.in/yaml.v2 v2.2.8
 )
 
 go 1.13
diff --git a/go.sum b/go.sum
index eaf9711..cea98d0 100644
--- a/go.sum
+++ b/go.sum
@@ -6,8 +6,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.2.0 h1:PbHHtYZpjKwZtGlIyELgA2DploRrsaXztoNNx9HjwNY=
-github.com/getkin/kin-openapi v0.2.0/go.mod h1:V1z9xl9oF5Wt7v32ne4FmiF1alpS4dM6mNzoywPOXlk=
+github.com/getkin/kin-openapi v0.3.0 h1:xsQ4mA20YJDMgIHdHqMKZ66QUe6/hi+x6yLsTTz8xyQ=
+github.com/getkin/kin-openapi v0.3.0/go.mod h1:W8dhxZgpE84ciM+VIItFqkmZ4eHtuomrdIHtASQIqi0=
 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 v4.0.2+incompatible h1:maB6vn6FqCxrpz4FqWdh4+lwpyZIQS7YEAUcHlgXVRs=
@@ -85,5 +85,5 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33
 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.2.5 h1:ymVxjfMaHvXD8RqPRmzHHsB3VvucivSkIAvJFDI5O3c=
-gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/pkg/runtime/styleparam.go b/pkg/runtime/styleparam.go
index a7f54c0..1d28131 100644
--- a/pkg/runtime/styleparam.go
+++ b/pkg/runtime/styleparam.go
@@ -132,7 +132,26 @@ func sortedKeys(strMap map[string]string) []string {
 	return keys
 }
 
+
+// This is a special case. The struct may be a time, in which case, marshal
+// it in RFC3339 format.
+func marshalTimeValue(value interface{}) (string, bool) {
+	if timeVal, ok := value.(*time.Time); ok {
+		return timeVal.Format(time.RFC3339Nano), true
+	}
+
+	if timeVal, ok := value.(time.Time); ok {
+		return timeVal.Format(time.RFC3339Nano), true
+	}
+
+	return "", false
+}
+
 func styleStruct(style string, explode bool, paramName string, value interface{}) (string, error) {
+	if timeVal, ok := marshalTimeValue(value); ok {
+		return stylePrimitive(style, explode, paramName, timeVal)
+	}
+
 	if style == "deepObject" {
 		if !explode {
 			return "", errors.New("deepObjects must be exploded")
@@ -140,12 +159,6 @@ func styleStruct(style string, explode bool, paramName string, value interface{}
 		return MarshalDeepObject(value, paramName)
 	}
 
-	// This is a special case. The struct may be a time, in which case, marshal
-	// it in RFC3339 format.
-	if timeVal, ok := value.(*time.Time); ok {
-		return timeVal.Format(time.RFC3339Nano), nil
-	}
-
 	// Otherwise, we need to build a dictionary of the struct's fields. Each
 	// field may only be a primitive value.
 	v := reflect.ValueOf(value)


Test patch:
diff --git a/internal/test/client/client.gen.go b/internal/test/client/client.gen.go
index 0f8570a..a775d16 100644
--- a/internal/test/client/client.gen.go
+++ b/internal/test/client/client.gen.go
@@ -995,15 +995,15 @@ func RegisterHandlers(router interface {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []string{
 
-	"H4sIAAAAAAAC/8xUzY4SQRB+lUnpcWRYvc1RD2ZNFCMkHpBsmp6C7s1Md1tV7GZCeHdTDcgQN8jBNXsh",
-	"1fRXle+nerZgY5diwCAM9RbYOuxMLqe5nCzv0YqeE8WEJB7z7coTyxfToR6kTwg1sJAPa9iVQLF96kJv",
-	"8OfGEzZQz/eocjBqsVOID6uozQ2yJZ/ExwA1zJznQpCFi0eH4pAKcVh8aD0GKUxoDuV3L+4bcoqBkQtD",
-	"WKwxIBnBprCRCK20/Y8AJbTeYuDMM2Qh8Pl2puzFi9KHGbIUU6QHJCjhAYn3VG5G49FYgTFhMMlDDe9G",
-	"49ENlJCMuOxP9ejF3S1j/mkOpqXI2Uo10qiu2wZq+BpZ3kdxsHcH9dT0irMxCIbcYlJqvc1N1T0rjWNY",
-	"Wr0mXEENr6pTmtUhyuosR/V3OCpaQXnDQmi685GrSJ0RqGHpg6Eeyj/CPEtTaIP5r4FwOsag89b4hPSP",
-	"eFI+wL4dj1+q5oFGpaTh9pej/aTM/0u0lwLJZI8mX8rjN91nzENpMdoNeemhnm9hkjATmIPOHRGaBsp9",
-	"bZrOB1jsFictUV//Fc5PFHe19c/1FPZsr7H+xPey9/9qgYWMb31Y33Fr2FV/2wr9ss4OLVPteKFrstv9",
-	"CgAA//91LTf11gYAAA==",
+	"H4sIAAAAAAAC/8yUz24TMRDGX2U1cFyyKdz2CAdUJAgikTiEqHK8k9jVrm1mJq1W0b47GicliahCkGjV",
+	"SzTO/NE338/rLdjYpRgwCEO9BbYOO5PDaQ4ny1u0oudEMSGJx5xdeWL5YjrUg/QJoQYW8mENQwkU28cS",
+	"msGfG0/YQD3fVZVHoxaDlviwitrcIFvySXwMUMPMeS4EWbi4dygOqRCHxYfWY5DChGYffvfiviGnGBi5",
+	"MITFGgOSEWwKG4nQStv/CFBC6y0GzjpDXgQ+X89UvXhR+TBDlmKKdIcEJdwh8U7K1Wg8GmthTBhM8lDD",
+	"u9F4dAUlJCMu+1Pde3E3y5h/mr1pKXK2Uo00utd1AzV8jSzvozjYuYN6anqtszEIhtxiUmq9zU3VLauM",
+	"B1gavSZcQQ2vqgPNao+yOuGo/h6PilZQ3rAQmu505CpSZwRqWPpgqIfyD5gnNIU2mP/YOw912LSt1hw5",
+	"cZTdwhof8eIjHqw4qn07Hr9UE4bDjipJaffnWX9S5c/C+p8IZfUP2XOAfut/QkAqi9FuyEsP9XwLk4RZ",
+	"wBx07ojQNFDuYtN0PsBiWBx2ifo+XIBionUXs3i2j2Un/xIWhwXOw/hfV1zI+NaH9Q23hl31t2uij/Fs",
+	"3zLVjhd6b4bhVwAAAP//2pHiCAkHAAA=",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/internal/test/components/components.gen.go b/internal/test/components/components.gen.go
index cf00683..e2f5972 100644
--- a/internal/test/components/components.gen.go
+++ b/internal/test/components/components.gen.go
@@ -1144,20 +1144,20 @@ func RegisterHandlers(router interface {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []string{
 
-	"H4sIAAAAAAAC/9xWy27bOhD9FWLuXQp2Hu1GOxdF0RRoGzQBukiMgBFHEVOZVEg6rhDo34shJcuRaVdO",
-	"s2lXtiTO4xyeeTxBpheVVqichfQJKm74Ah0a/3TePX29vcfM0atMK4fK/+VVVcqMO6nV9N5qRe9sVuCC",
-	"e09GV2icRO/pg8RS0J//DeaQwn/TPu40GNnphf9tYzVNAgYfltKggPSq9TCn1w5/um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SSgE/vnbQEYT+te8szsPQnZ+5X8bW3XNqIGntTQgaHLTaFjitYPvbl4WXPZMuqoEmlDr",
+	"jFQPtManAmxqZIk+0oRyssVHGUVx+rQGU22NgXX/adH4/GV7Uf12yIMOW2plWzDh8IdEckGsXJUFkBYk",
+	"0Z2xxgtUtBBCoggvLrcoglunHnjk8459qRw8gKED8++5JZ0s6RgiOiMoTKRylPWokyKuW/EVRFAzqstg",
+	"IEbJPqdeBUMLS9Y+bRlhB1g4G2ch44WFPvD/NViitCO8KPQmzsGv4n4jaOfj0JxZD5AtEJAlXFURVNUA",
+	"0xG+H+f2P8e57TNRaVWt9NqSDEuLbHKZ5iQfy9FhfJQC8zOzbwp/mnjwi72GxX8PVff0zjW97jfS5SQo",
+	"IZk2RMjUPzKB8IHrwcJX6fIPVqttU53EMqPPvFiD72CZNivuaEJ932YjT88mPI2XXWMpxv4eVQPfM2ms",
+	"+zQGwOhiQgL4V2xH1dKPAqkyjcKFTEFZ6JiiHy+uUbuTDtXTa7COXIF59mn0DMaGMJ7OTmYnocGC4qWk",
+	"CT2fncxOsTK4y73/c78q2DsM7B0X4g7h+S8P4OH2BxJKhjTolijClSCc3GtRNVXZwItn0S2GBQ9+FF8I",
+	"moQVzGKeLIS49C6wvS3tpu/JdS5t58J4G/DGdnagtippiTx0YQjl383mQ01ikCPWVT4SYVrTmk3xVu10",
+	"NN8Dtm24IVEBCEucJvdwq9zaKBA4cDXhzcswg7EOY96i5Eabb+MMnB1k4KjuGUn+HkvRrres6+XeCqfW",
+	"RVEzWmobyT7fl0izwe6mGy55XCr8KqSB1EUJYZint+og8ZjYMdlIzuLG3MtY88pdevpEmhqGnf3jlWOp",
+	"XUjaONX9XKmHgavr+kcAAAD//xxDQTJrDQAA",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/internal/test/parameters/parameters.gen.go b/internal/test/parameters/parameters.gen.go
index e2efb1e..944e9be 100644
--- a/internal/test/parameters/parameters.gen.go
+++ b/internal/test/parameters/parameters.gen.go
@@ -3056,24 +3056,23 @@ func RegisterHandlers(router interface {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []string{
 
-	"H4sIAAAAAAAC/9xaS2/bOBD+K8bsnhaq5bY33YLuK8D2sescFihyYKRxzK4ksiQdxDD03xd82LIelilH",
-	"lt3cGmk4883Hj9PhyBuIWcZZjrmSEG1AoOQsl2j+mNOMp/iPe6SfxCxXmCv9T4XPKuQpobn+S8ZLzIh5",
-	"vuYIEUglaP4IRVEEkKCMBeWKshwiuJlI43eyjTVhD98wVqBNrR8T/QPTVs+f7ctoA1wwjkJRC+422YtG",
-	"c4WPKKAI4FbeJJkF5V4+MJYiyfXL0tnPAhcQwU9hmX/ogoefSzwCv6+owASir9vFgQ5dxrmvuK1iXFAh",
-	"1SeSYQsxAQiWtr2oRTVWwZ6re8MpzRdML05pjG5zchMIPt7eae+KKu0e7lCqyRzFEwoI4AmFtNvwdjqb",
-	"zrQh45gTTiGC99PZ9C0EwIlaGvyh22+bX7jhRJCs0G8e0aSrkyV6X/VuwB+oPuwvMK4EyVChkBB9reiH",
-	"cJ7S2CwOv0lWU1HX9lSF4diAyMCGYEuDiQz7XCqxwuI+qGr83Wx2KN7OLqwdhMLEDGPG/qPYzYaxaNBQ",
-	"PRBc0Iwq+qQN8ZmnLEGIFiSV6BKLt262qVXScpYldwsmMqLsqXj/DoLGISkCLwiarwMIcHgILmwyIUKQ",
-	"tS8O0o2DKsykF6DdExu+BWADV9cWjYhrRxzbHjov5lg3Qr/6WMfShNBF0kAQzlVUqqnF1qBkuTWluCWn",
-	"4t6UiyWSBEVXufjTWry0XCy3bhymf9982VsybuHowPLmNyfcy5SSJrIbbe2JarTCcgDmtZWXJkx7kjzp",
-	"PEe1OQTpxy86zcyco4MZuhKUkgdM3Y4YGYWbqak1v3Q2dX/VlzVLVJsmfPqxYVQbgFRr0+2aDGGgLi8A",
-	"ucoyItYQ5as0bVC4bYv7cnioOx6CRB/9jk3XJ9amueN0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qM4rIaxaMnQLAgu",
+	"aEIVfdCG+MhjFiEEGxJLzImFhZuCGng1qTZMJETZInj/DrxWTWTeKEQtTw8gnoyYo0QLIgR5GgtLGrBU",
+	"YSJH4ZdPLFpHPK0whvSeL4xSFlYUzChdWCOgca3MhW4jDklwHOJc5d5kElqDSsNOBiEDp/jTXRybQt4i",
+	"iVAMFfKf1uLUQt4WbvKY/n3zpbZk1pIegH7zW56Fz1Lk7UCutHV3EM9W8j1RvXDht6OyVdAt1hx9oC+C",
+	"V9cO2kRyRwWhvuYQkzuMc71NTvj7pekCvwwOQn+5y9rNo2vHx8ww58lJD6R6MhOiYQjnnIzqmhWz41TR",
+	"+kbIc6g2JmFn1+cT68qqw/o01w0IVK/jHyivSv7NzJog3MHUOkW5l86thChBH53UotFw4X1sLTqm8Gg0",
+	"e05ZdvMJVubUJMWO71UHJJuWTLOJ02pVNBohzhka1WvOqHafmqbaCV3q0rOKEylvtoLt7rdjLpW+VOaD",
+	"V0oTriRf5MLo+w7F06+IvLov7KNcszpw6IwQ+fApwsBWPCPr+ugMcQbwKlGiKua+YdqE8jsTyRD3v0uj",
+	"A9RHnTcd9me7U6p466Uw8bzpRPVsQY07d7qazX/f5CCeA7CkeuhqxGU7z/XqANsjAF/yKO1E375YO6lJ",
+	"2o9DzXljxNFx3Vp2uQduS3E+1RqfaybIdjlH7tkUcifZw8PHumPdBR+651du/MfAddfCizh2z6ZSeak+",
+	"Xp/6JwBHmaOUGJE8c8mgXZsvzTb8nYghgK1SPPD9/DOzQqmWelJMCF8SCtlt9n8AAAD//xeCHE2EIAAA",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/internal/test/schemas/schemas.gen.go b/internal/test/schemas/schemas.gen.go
index 3d7fdf2..c22d1d7 100644
--- a/internal/test/schemas/schemas.gen.go
+++ b/internal/test/schemas/schemas.gen.go
@@ -734,18 +734,18 @@ func RegisterHandlers(router interface {
 // Base64 encoded, gzipped, json marshaled Swagger object
 var swaggerSpec = []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umgA9NDnQ4sjihiIZcuhEEPTvBSm7VuI4",
+	"RZD2ZErizLw3M+95xMb2zhoyHLAeMTQd9SIff7xi4Tn8qbj7PfYb8umlpNB45VhZgzVedyrAHAJG9AQh",
+	"h8CD4g4EmDmsQB4cYY12840axqnAn81wPThaYz0eny7OFehs1BI2BMKAMky+FQ2NU0r0KQa2/RV7ZbbX",
+	"ucqIrfW9YKyxyR+P9UO+lsJ+JUNeNV9mQPX4HOE0FahMa19ARIGhEYECtNbDTnhlYwAVQsyvopFgd+SB",
+	"VU8lfNUkAoGQEgTwITaF3hhhBtjELbTqkWR5YxJQxZoOVa7I73L7duTDXH1drspVImAdGeEU1nhZrso1",
+	"FugEd3lu1YylWl/8lB63xKcsfhN3BCF6gmhCdM56JgmNNUyPDKkZAaQ1PzA4T9Q7huOt/HWGax15kVJ+",
+	"lljj51Q3VS3QU3DWBMqALlar9JOzmwxGOKdVkyOrbyEhOmxeOn3vqcUav6uOq1nt97J6Org0pmWux16/",
+	"J1UiX/XC30n7YN6daBDvQZPSSGpF1Pw/Nu8/YjzNeA+bd7mqxlZozZ23cdtNp/v3B4W03BLuaHiwXi5F",
+	"7jxlRYAyWV5ioym7y37p9gv9wu5drp6unolaT0kZXvTE5APWf42oEoCkFiwwpcUaF2BzhvuoPEms2Ucq",
+	"Fj155iPT7YL0h3U1rnOp6azsvh6QLNxSme3sl/+45QvMPswK/zcec/1XKbw21lPHn6bb044uSH88S/WT",
+	"VmQYMqCQPQOUaaz31LAe0llHSTKbaEKbDC+3YWPlAMLIG3Pke9ZtPp5py30kPyzma+3b5jpfpsC/WDm8",
+	"RX973S478SUfhM7Mknef9HMqMMthzyB6jTV2zK6uqr3Rp7+OUhK5XrhSKJxup78DAAD//8VdLP27BwAA",
 }
 
 // GetSwagger returns the Swagger specification corresponding to the generated code
diff --git a/pkg/runtime/styleparam_test.go b/pkg/runtime/styleparam_test.go
index 33c6c8a..48ad36e 100644
--- a/pkg/runtime/styleparam_test.go
+++ b/pkg/runtime/styleparam_test.go
@@ -15,6 +15,7 @@ package runtime
 
 import (
 	"testing"
+	"time"
 
 	"github.com/stretchr/testify/assert"
 )
@@ -33,6 +34,7 @@ func TestStyleParam(t *testing.T) {
 	dict := map[string]interface{}{}
 	dict["firstName"] = "Alex"
 	dict["role"] = "admin"
+	timestamp, _ := time.Parse(time.RFC3339, "2020-01-01T22:00:00Z")
 
 	// ---------------------------- Simple Style -------------------------------
 
@@ -68,6 +70,22 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, "firstName=Alex,role=admin", result)
 
+	result, err = StyleParam("simple", false, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("simple", true, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("simple", false, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("simple", true, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "2020-01-01T22:00:00Z", result)
+
 	// ----------------------------- Label Style -------------------------------
 
 	result, err = StyleParam("label", false, "id", primitive)
@@ -102,6 +120,22 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, ".firstName=Alex.role=admin", result)
 
+	result, err = StyleParam("label", false, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ".2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("label", true, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ".2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("label", false, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ".2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("label", true, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ".2020-01-01T22:00:00Z", result)
+
 	// ----------------------------- Matrix Style ------------------------------
 
 	result, err = StyleParam("matrix", false, "id", primitive)
@@ -136,6 +170,22 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, ";firstName=Alex;role=admin", result)
 
+	result, err = StyleParam("matrix", false, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ";id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("matrix", true, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ";id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("matrix", false, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ";id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("matrix", true, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, ";id=2020-01-01T22:00:00Z", result)
+
 	// ------------------------------ Form Style -------------------------------
 	result, err = StyleParam("form", false, "id", primitive)
 	assert.NoError(t, err)
@@ -169,6 +219,22 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, "firstName=Alex&role=admin", result)
 
+	result, err = StyleParam("form", false, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("form", true, "id", timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("form", false, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "id=2020-01-01T22:00:00Z", result)
+
+	result, err = StyleParam("form", true, "id", &timestamp)
+	assert.NoError(t, err)
+	assert.EqualValues(t, "id=2020-01-01T22:00:00Z", result)
+
 	// ------------------------  spaceDelimited Style --------------------------
 
 	result, err = StyleParam("spaceDelimited", false, "id", primitive)
@@ -196,6 +262,19 @@ func TestStyleParam(t *testing.T) {
 
 	result, err = StyleParam("spaceDelimited", true, "id", dict)
 	assert.Error(t, err)
+
+	result, err = StyleParam("spaceDelimited", false, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("spaceDelimited", true, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("spaceDelimited", false, "id", &timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("spaceDelimited", true, "id", &timestamp)
+	assert.Error(t, err)
+
 	// -------------------------  pipeDelimited Style --------------------------
 
 	result, err = StyleParam("pipeDelimited", false, "id", primitive)
@@ -224,6 +303,18 @@ func TestStyleParam(t *testing.T) {
 	result, err = StyleParam("pipeDelimited", true, "id", dict)
 	assert.Error(t, err)
 
+	result, err = StyleParam("pipeDelimited", false, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("pipeDelimited", true, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("pipeDelimited", false, "id", &timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("pipeDelimited", true, "id", &timestamp)
+	assert.Error(t, err)
+
 	// ---------------------------  deepObject Style ---------------------------
 	result, err = StyleParam("deepObject", false, "id", primitive)
 	assert.Error(t, err)
@@ -249,6 +340,19 @@ func TestStyleParam(t *testing.T) {
 	assert.NoError(t, err)
 	assert.EqualValues(t, "id[firstName]=Alex&id[role]=admin", result)
 
+	result, err = StyleParam("deepObject", false, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("deepObject", true, "id", timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("deepObject", false, "id", &timestamp)
+	assert.Error(t, err)
+
+	result, err = StyleParam("deepObject", true, "id", &timestamp)
+	assert.Error(t, err)
+
+
 	// Misc tests
 	// Test type aliases
 	type StrType string