oapi-codegen
oapi-codegen copied to clipboard
Broken code is generated when HTTP Response Header starts with digit
I'm in trouble to generate code with following conditions.
- HTTP response schema defined via reference(
$ref) - HTTP response has HTTP header starts with digits.
According to RFC7230, HTTP header can start with digit. ref. https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.6
reproduce example
go run github.com/deepmap/oapi-codegen/cmd/oapi-codegen --config=config.yaml spec.yaml
## spec.yaml
openapi: 3.0.2
info:
version: "0.0.1"
paths:
/foo:
get:
responses:
200:
$ref: "#/components/responses/200"
components:
responses:
"200":
headers:
"000-foo":
schema:
type: string
## config.yaml
package: head_digit_of_httpheader
generate:
strict-server: true
output: issue.gen.go
output-options:
skip-prune: true
TIL this is a valid option - thanks for the fix! We'll try and get to reviewing the PRs you've raised shortly
Thank you. I've confirmed resolved this.