mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-09 21:36:13 +00:00
[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:
@@ -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}}
|
||||
|
||||
@@ -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...
|
||||
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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}}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user