I'd like to generate Javadoc for models created via OpenAPI 2.0 -> 
swagger-codegen -l spring
so that developers can marshal JSON to Java objects when calling the APIs 
(naked SDK).

Is there a javadoc doclet which can take descriptions of models from 
swagger annotations and put those into the generated Javadoc HTML?

@ApiModel(description = "my model description from openapi.yaml....")
public class MyModel {
  private String abc;
  public void setAbc(String abd) { this.abc = abc; };
  
  @ApiModelProperty(description = "My field description from 
openapi.yaml....")
  public String getAbc() { return abc; }

and generate Javadoc as if the source contain Javadoc comments:

/**
 * my model description from openapi.yaml....
 */
public class MyModel {
  private String abc;
  public void setAbc(String abd) { this.abc = abc; };
  
  /** 
   * My field description from openapi.yaml.... 
   */
  public String getAbc() { return abc; }


Note: I could hack swagger-codegen to emit Javadoc comments, but then there 
is duplication of text.

Bonus points if this handles classes which use Lombok i(which 
swagger-codegen does not yet do...) instead of explicit getters/setters 
(i.e. the @ApiModelProperty annotation is on a private field, so it is not 
sufficient to just change that to a javadoc comment on the field, which 
won't be rendered in Javadoc by default, but instead move the description 
to the "generated" getter. 'Twould be nice to also support fluent 
properties (i.e. MyModel abc(String) and String abc() methods instead of 
setAbc/getAbc).

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to