swagger-api / swagger-api/swagger-codegen

swagger-codegen generate should not generate WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: post /foo

Open
#5,162 5 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

swagger-codegen generate should not generate WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: post /foo

since the spec does not define operationId as required and swagger-codegen can autogenerate value for it.

Or at least a command line option to silence the warning should be provided because now it only makes more difficult to spot issues.

The warning would also be more useful if it shown line number and possibly column. While not essential in this case (the method and path is provided), this threw me off a bit especially at the beggining when I had a lot of warnings.

Swagger-codegen version

current master; HEAD = 1c160df33897898da1c39f230c737eb6a313e6ba

Swagger declaration file content or url
swagger: '2.0'

info:
  title: "sscce"
  version: '1.0'
  description: sscce

definitions:
  foo:
    type: string


paths:
  /foo:
    post:
      parameters:
        - name: foo
          in: body
          schema: {$ref: "#/definitions/foo"}
      responses:
        "200":
          description: foo
          type: string
Command line used for generation

JAR=".../swagger-codegen.git/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
java -jar "${JAR}" generate -i ~/sscce.yaml -l html2 -o foo

outputs:

swagger-codegen generate -i sscce.yaml -l html2 -o sscce.html
[main] INFO io.swagger.parser.Swagger20Parser - reading from sscce.yaml
[main] WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: post /foo. Renamed to auto-generated operationId: fooPost
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /home/yac/sscce.html/index.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generate command and the warning emitted by io.swagger.codegen.DefaultCodegen when the sample sscce.yaml has no operationId for POST /foo. Determine whether the missing operationId warning should be suppressed or made configurable, and whether location details are feasible. Done means generation still produces the autogenerated operationId while the warning behavior matches the selected resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.