Closed glucas closed 8 years ago
OK - adding a path before running the codegen step prevents the NPE, so I do think this is an issue with the doclet. This variation of the above example works fine:
{ "apiVersion" : "1", "swaggerVersion" : "1.2", "basePath" : "http://localhost:8180/ws/test", "resourcePath" : "/root", "apis" : [ { "path" : "/", "operations" : [ { "method" : "GET", "nickname" : "getSomething", "type" : "SomeBean", "summary" : "Gets the thing", "produces" : [ "application/json", "application/xml" ] } ] }, { "path" : "/publish", "operations" : [ { "method" : "POST", "nickname" : "publishSomething", "type" : "void", ...
I've got things working locally with a small change to ApiMethodParser#parse: just replacing a "" path with "/" works for me. I can submit a pull request.
@glucas thanks for your help ive merged this in now
I'm using the swagger-doclet (along with the swagger-codegen-maven-plugin) to generate documentation from a JAX-RS API.
Resources that have operations at the application root path (with @Path("/") or @Path("")) cause a NullPointerException during codegen. I'm not entirely sure if this is an issue with the doclet or codegen, but the doclet is generating a json spec that has api operations with no corresponding path such as the GET below:
{ "apiVersion" : "1", "swaggerVersion" : "1.2", "basePath" : "http://localhost:8180/ws/test", "resourcePath" : "/root", "apis" : [ { "operations" : [ { "method" : "GET", "nickname" : "getSomething", "type" : "SomeBean", "summary" : "Gets the thing", "produces" : [ "application/json", "application/xml" ] } ] }, { "path" : "/publish", "operations" : [ { "method" : "POST", "nickname" : "publishSomething", "type" : "void", ...