Skip to content

Broken code is generated when spec. includes operationId starts with digit #734

Closed

Description

@masu-mi

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

Activity

  1. ghost closed this as completedin #735on Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions