When generating a strict (Echo) interface for an API that contains properties that are reserved Go keywords, the generated code is invalid.
YAML spec:
openapi: 3.0.0
info:
title: api
description: sample api
version: "0.0.0"
paths:
/endpoint/{type}:
get:
parameters:
- in: path
name: type
required: true
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
type: string
YAML config:
package: pr
generate:
echo-server: true
models: true
strict-server: true
Generated code:
type GetEndpointTypeRequestObject struct {
Type string `json:"type"`
}
func (sh *strictHandler) GetEndpointType(ctx echo.Context, pType string) error {
var request GetEndpointTypeRequestObject
request.PType = pType // compilation error, should've been request.Type = pType
// etc
}
(see https://github.com/reinkrul/oapi-codegen/tree/reserved-keywords-bug/pr)
Probably related to #30
When generating a strict (Echo) interface for an API that contains properties that are reserved Go keywords, the generated code is invalid.
YAML spec:
YAML config:
Generated code:
(see https://github.com/reinkrul/oapi-codegen/tree/reserved-keywords-bug/pr)
Probably related to #30