sbt-swagger-codegen
sbt-swagger-codegen copied to clipboard
java.lang.Exception: Please provide an operationId
I get the following error when running swaggerClientCodeGen
on a (3rd-party generated) yaml file:
[error] (*:swaggerClientCodeGen) java.lang.Exception: Please provide an operationId in ...
As far as I can tell from the specification, operationId
is not marked as "Required":
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#operationObject
We use the operationId as the method name in the controller, that's why it must be present.
Yes, I understand the motivation, but I think that in the context of open standards and interoperability the plugin would be useful to more people if it actually adhered to the specification.
In this case you could for instance fall back to generating a method name from the path, or synthesizing it like operation1, operation2 etc.
That said I would like to add that I still find the plugin very useful, so thanks for creating it and open sourcing it!
Thanks. Indeed we could better respect the specification and provide defaults for non mandatory specifications such as this one (and the successful response of #61). We can implement this in future. In the meantime if you would like to contribute with a PR on this, it would be highly appreciated :)