swagger-codegen generate should not generate WARN io.swagger.codegen.DefaultCodegen - Empty operationId found for path: post /foo
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
Any update?
bump
Still relevant
well you are missing the operationId, or am I missing something?
post:
summary: Add a new user
operationId: addUser // <---- this here
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/User'
responses:
'201':
description: User created
@mathmul
You're missing this sentence from the OP:
since the spec does not define operationId as required and swagger-codegen can autogenerate value for it.