oapi-codegen
oapi-codegen copied to clipboard
Broken code is generated when spec. includes operationId starts with digit
When operationId that starts with digit is set explicitly, I can't get correct go code.
To avoid trouble, we can overwrite the operationId with other word but 3GPP's specification have many opeartionId fields start with digit. I understand it's not recommended value for operationId, but it's not banned.
Tools and libraries MAY use the operationId to uniquely identify an operation, therefore, it is RECOMMENDED to follow common programming naming conventions. ref. https://spec.openapis.org/oas/v3.1.0#operation-object
Because of it, I think it's acceptable to add some prefix string (e.g. Op) when operationId start with some digit.
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:
/3gpp/foo:
get:
operationId: 3GPPFoo
## config.yaml
package: head_digit_of_opeartion_id
generate:
strict-server: true
output: issue.gen.go
output-options:
skip-prune: true