oapi-codegen
oapi-codegen copied to clipboard
Panic invalid port with Server Variable Object
According to this the following should be a legal spec:
servers:
- url: http://localhost:{port}/v1
description: The local test server
variables:
port:
default: '8080'
however, the oapi validate middleware throws an error:
panic: parse "http://localhost:--------------------------------------------------port__________________________________________________/v1": invalid port ":--------------------------------------------------port__________________________________________________" after host
github.com/deepmap/oapi-codegen/pkg/middleware.OapiRequestValidatorWithOptions(0xaf7600?, 0x0)
/home/matthias/go/pkg/mod/github.com/deepmap/[email protected]/pkg/middleware/oapi_validate.go:72 +0xf9
github.com/deepmap/oapi-codegen/pkg/middleware.OapiRequestValidator(...)
/home/matthias/go/pkg/mod/github.com/deepmap/[email protected]/pkg/middleware/oapi_validate.go:56
This is an error from a dependency of ours, here: https://github.com/deepmap/oapi-codegen/blob/master/pkg/middleware/oapi_validate.go#L76
We use: https://github.com/getkin/kin-openapi/tree/master/routers/gorillamux
Please open an issue with the kin-openapi project.