[Java][JAXRS-CXF] Improve API documentation in the CXF Server stub and Client generation (#6708)

* Inclusion of API documentation in CXF Server stub generation

* Inclusion of API documentation in CXF client generation

* Update of the Petstore CXF server sample

* Update of the Petstore CXF client sample

* Update of the Petstore CXF server annotated base path sample

* Update of the Petstore CXF server non spring application sample

* Changed {{{appDescription}}} to {{appDescription}} to use the HTML-escaped value in handling special characters like <, > in the description following the correction made by @wing328

* Update of the Petstore CXF samples
This commit is contained in:
Gustavo Paz
2017-10-22 10:00:48 -05:00
committed by wing328
parent d2eb7cb35b
commit 7cbd36e75b
63 changed files with 1247 additions and 2 deletions

View File

@@ -22,6 +22,16 @@ import javax.validation.constraints.*;
import javax.validation.Valid;
{{/useBeanValidation}}
{{#appName}}
/**
* {{{appName}}}
*
{{#appDescription}}
* <p>{{{appDescription}}}
*
{{/appDescription}}
*/
{{/appName}}
@Path("{{^useAnnotatedBasePath}}/{{/useAnnotatedBasePath}}{{#useAnnotatedBasePath}}{{contextPath}}{{/useAnnotatedBasePath}}")
@Api(value = "/", description = "{{description}}")
{{#addConsumesProducesJson}}
@@ -32,6 +42,16 @@ public interface {{classname}} {
{{#operations}}
{{#operation}}
{{#summary}}
/**
* {{summary}}
*
{{#notes}}
* {{notes}}
*
{{/notes}}
*/
{{/summary}}
@{{httpMethod}}
{{#subresourceOperation}}@Path("{{{path}}}"){{/subresourceOperation}}
{{#hasConsumes}}

View File

@@ -25,9 +25,29 @@ import org.springframework.stereotype.Service;
{{/useSpringAnnotationConfig}}
{{#description}}
{{/description}}
{{#appName}}
/**
* {{{appName}}}
*
{{#appDescription}}
* <p>{{{appDescription}}}
{{/appDescription}}
*
*/
{{/appName}}
public class {{classname}}ServiceImpl implements {{classname}} {
{{#operations}}
{{#operation}}
{{#summary}}
/**
* {{summary}}
*
{{#notes}}
* {{notes}}
*
{{/notes}}
*/
{{/summary}}
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParamsImpl}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
// TODO: Implement...

View File

@@ -42,7 +42,15 @@ import org.springframework.test.context.web.WebAppConfiguration;
/**
* API tests for {{classname}}
{{#appName}}
* {{{appName}}}
*
{{/appName}}
{{#appDescription}}
* <p>{{{appDescription}}}
*
{{/appDescription}}
* API tests for {{classname}}
*/
{{#generateSpringBootApplication}}
@RunWith(SpringJUnit4ClassRunner.class)
@@ -91,10 +99,14 @@ public class {{classname}}Test {
{{#operations}}{{#operation}}
/**
{{#summary}}
* {{summary}}
*
{{#notes}}
* {{notes}}
*
{{/notes}}
{{/summary}}
* @throws ApiException
* if the Api call fails
*/

View File

@@ -17,6 +17,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
{{^parent}}@XmlRootElement(name="{{classname}}"){{/parent}}
{{/withXml}}
{{#description}}
/**
* {{{description}}}
**/
@ApiModel(description="{{{description}}}")
{{/description}}
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
@@ -29,6 +32,11 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {
@XmlElement(name="{{baseName}}"{{#required}}, required = {{required}}{{/required}})
{{/withXml}}
@ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
{{#description}}
/**
* {{{description}}}
**/
{{/description}}
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
{{#vars}}

View File

@@ -4,6 +4,9 @@
<artifactId>{{artifactId}}</artifactId>
<packaging>jar</packaging>
<name>{{artifactId}}</name>
{{#appDescription}}
<description>{{appDescription}}</description>
{{/appDescription}}
<version>{{artifactVersion}}</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>

View File

@@ -4,6 +4,9 @@
<artifactId>{{artifactId}}</artifactId>
<packaging>war</packaging>
<name>{{artifactId}}</name>
{{#appDescription}}
<description>{{appDescription}}</description>
{{/appDescription}}
<version>{{artifactVersion}}</version>
<build>
<sourceDirectory>src/main/java</sourceDirectory>