swagger-api / swagger-codegen

swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
http://swagger.io
Apache License 2.0
17.01k stars 6.03k forks source link

[codegen]{ze-ph} Lack of implementation for http HEAD method in ZendExpressivePathHandlerServerCodegen #6491

Open sq2wkh opened 7 years ago

sq2wkh commented 7 years ago
Description

During generation of ze-ph code , codegen throws exception:

Exception in thread "main" java.lang.RuntimeException: Could not generate api file for '/servers' at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:463) at io.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:666) at io.swagger.codegen.cmd.Generate.run(Generate.java:234) at io.swagger.codegen.SwaggerCodegen.main(SwaggerCodegen.java:41) Caused by: java.lang.RuntimeException: Unknown HTTP Method HEAD not allowed at io.swagger.codegen.languages.ZendExpressivePathHandlerServerCodegen.postProcessOperations(ZendExpressivePathHandlerServerCodegen.java:150) at io.swagger.codegen.DefaultGenerator.processOperations(DefaultGenerator.java:885) at io.swagger.codegen.DefaultGenerator.generateApis(DefaultGenerator.java:380) ... 3 more

Swagger-codegen version

swagger-codegen-cli-2.2.2

Command line used for generation

java -jar swagger-codegen-cli-2.2.2.jar generate -i http://host:port/some-service/swagger.json -l ze-ph -o /tmp/ze-ph

Suggest a fix/enhancement

Implement code for missing http methods in ZendExpressivePathHandlerServerCodegen.java

wing328 commented 7 years ago

@sq2wkh Can you try the latest master to see if the issue still occurs? Snapshot version available at https://github.com/swagger-api/swagger-codegen#compatibility

sq2wkh commented 7 years ago

Hi @wing328

Issue still exist. Tested on: swagger-codegen-cli-2.3.0-20170927.021746-163. There is no implementation for HEAD method.

wing328 commented 6 years ago

Please share the spec via https://gist.github.com so that we can use it to reproduce the issue.

Have you tried other PHP server generator to see if you encounter similar issues?

sq2wkh commented 6 years ago

No, i tried only generation for ze-ph. Here is specification: https://gist.github.com/sq2wkh/b7f2067e189a2fcabdad988cc807f2f6