forked from loafle/openapi-generator-original
better docstring for jersey2 client (#6104)
This commit is contained in:
parent
bc097cfdde
commit
001d9cb36d
@ -7,23 +7,48 @@ import java.lang.reflect.Type;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class for oneOf,anyOf schemas defined in OpenAPI spec
|
||||||
|
*/
|
||||||
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}
|
{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}
|
||||||
public abstract class AbstractOpenApiSchema {
|
public abstract class AbstractOpenApiSchema {
|
||||||
|
|
||||||
|
// store the actual instance of the schema/object
|
||||||
private Object instance;
|
private Object instance;
|
||||||
|
|
||||||
public final String schemaType;
|
// schema type (e.g. oneOf, anyOf)
|
||||||
|
private final String schemaType;
|
||||||
|
|
||||||
public AbstractOpenApiSchema(String schemaType) {
|
public AbstractOpenApiSchema(String schemaType) {
|
||||||
this.schemaType = schemaType;
|
this.schemaType = schemaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get the list of schemas allowed to be stored in this object
|
||||||
|
*
|
||||||
|
* @return an instance of the actual schema/object
|
||||||
|
*/
|
||||||
public abstract Map<String, GenericType> getSchemas();
|
public abstract Map<String, GenericType> getSchemas();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get the actual instance
|
||||||
|
*
|
||||||
|
* @return an instance of the actual schema/object
|
||||||
|
*/
|
||||||
public Object getActualInstance() {return instance;}
|
public Object getActualInstance() {return instance;}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Set the actual instance
|
||||||
|
*
|
||||||
|
* @param instance the actual instance of the schema/object
|
||||||
|
*/
|
||||||
public void setActualInstance(Object instance) {this.instance = instance;}
|
public void setActualInstance(Object instance) {this.instance = instance;}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Get the schema type (e.g. anyOf, oneOf)
|
||||||
|
*
|
||||||
|
* @return the schema type
|
||||||
|
*/
|
||||||
public String getSchemaType() {
|
public String getSchemaType() {
|
||||||
return schemaType;
|
return schemaType;
|
||||||
}
|
}
|
||||||
|
@ -44,14 +44,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the status code
|
||||||
|
*
|
||||||
|
* @return status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the headers
|
||||||
|
*
|
||||||
|
* @return map of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data
|
||||||
|
*
|
||||||
|
* @return data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -63,5 +63,10 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the object mapper
|
||||||
|
*
|
||||||
|
* @return object mapper
|
||||||
|
*/
|
||||||
public ObjectMapper getMapper() { return mapper; }
|
public ObjectMapper getMapper() { return mapper; }
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
{{/fullJavaUtil}}
|
|
||||||
|
|
||||||
|
{{/fullJavaUtil}}
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
{{#operations}}
|
{{#operations}}
|
||||||
public class {{classname}} {
|
public class {{classname}} {
|
||||||
@ -31,13 +31,24 @@ public class {{classname}} {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
{{^vendorExtensions.x-group-parameters}}
|
{{^vendorExtensions.x-group-parameters}}
|
||||||
/**
|
/**
|
||||||
@ -170,7 +181,8 @@ public class {{classname}} {
|
|||||||
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
|
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
}
|
}
|
||||||
{{#allParams}}{{^isPathParam}}
|
{{#allParams}}
|
||||||
|
{{^isPathParam}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set {{paramName}}
|
* Set {{paramName}}
|
||||||
@ -181,7 +193,8 @@ public class {{classname}} {
|
|||||||
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
|
this.{{localVariablePrefix}}{{paramName}} = {{paramName}};
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/isPathParam}}{{/allParams}}
|
{{/isPathParam}}
|
||||||
|
{{/allParams}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute {{operationId}} request
|
* Execute {{operationId}} request
|
||||||
@ -216,9 +229,12 @@ public class {{classname}} {
|
|||||||
{{/responses}}
|
{{/responses}}
|
||||||
</table>
|
</table>
|
||||||
{{/responses.0}}
|
{{/responses.0}}
|
||||||
{{#isDeprecated}}* @deprecated{{/isDeprecated}}
|
{{#isDeprecated}}
|
||||||
|
* @deprecated{{/isDeprecated}}
|
||||||
*/
|
*/
|
||||||
{{#isDeprecated}}@Deprecated{{/isDeprecated}}
|
{{#isDeprecated}}
|
||||||
|
@Deprecated
|
||||||
|
{{/isDeprecated}}
|
||||||
public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException {
|
public ApiResponse<{{#returnType}}{{{.}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException {
|
||||||
return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
return {{operationId}}WithHttpInfo({{#allParams}}{{localVariablePrefix}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||||
}
|
}
|
||||||
@ -234,7 +250,9 @@ public class {{classname}} {
|
|||||||
{{#externalDocs}}* {{description}}
|
{{#externalDocs}}* {{description}}
|
||||||
* @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}}
|
* @see <a href="{{url}}">{{summary}} Documentation</a>{{/externalDocs}}
|
||||||
*/
|
*/
|
||||||
{{#isDeprecated}}@Deprecated{{/isDeprecated}}
|
{{#isDeprecated}}
|
||||||
|
@Deprecated
|
||||||
|
{{/isDeprecated}}
|
||||||
public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException {
|
public API{{operationId}}Request {{operationId}}({{#pathParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}) throws ApiException {
|
||||||
return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}});
|
return new API{{operationId}}Request({{#pathParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}});
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,9 @@ import java.util.Map.Entry;
|
|||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
{{/caseInsensitiveResponseHeaders}}
|
{{/caseInsensitiveResponseHeaders}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API Exception
|
||||||
|
*/
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
public class ApiException extends{{#useRuntimeException}} RuntimeException {{/useRuntimeException}}{{^useRuntimeException}} Exception {{/useRuntimeException}}{
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
|
@ -26,10 +26,6 @@ public class {{classname}} extends AbstractOpenApiSchema{{#vendorExtensions.x-im
|
|||||||
return {{classname}}.schemas;
|
return {{classname}}.schemas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSchemaType() {
|
|
||||||
return schemaType;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setActualInstance(Object instance) {
|
public void setActualInstance(Object instance) {
|
||||||
{{#oneOf}}
|
{{#oneOf}}
|
||||||
|
@ -15,6 +15,7 @@ package org.openapitools.client;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/** API Exception */
|
||||||
public class ApiException extends Exception {
|
public class ApiException extends Exception {
|
||||||
private int code = 0;
|
private int code = 0;
|
||||||
private Map<String, List<String>> responseHeaders = null;
|
private Map<String, List<String>> responseHeaders = null;
|
||||||
|
@ -44,14 +44,29 @@ public class ApiResponse<T> {
|
|||||||
this.data = data;
|
this.data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the status code
|
||||||
|
*
|
||||||
|
* @return status code
|
||||||
|
*/
|
||||||
public int getStatusCode() {
|
public int getStatusCode() {
|
||||||
return statusCode;
|
return statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the headers
|
||||||
|
*
|
||||||
|
* @return map of headers
|
||||||
|
*/
|
||||||
public Map<String, List<String>> getHeaders() {
|
public Map<String, List<String>> getHeaders() {
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data
|
||||||
|
*
|
||||||
|
* @return data
|
||||||
|
*/
|
||||||
public T getData() {
|
public T getData() {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,11 @@ public class JSON implements ContextResolver<ObjectMapper> {
|
|||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the object mapper
|
||||||
|
*
|
||||||
|
* @return object mapper
|
||||||
|
*/
|
||||||
public ObjectMapper getMapper() {
|
public ObjectMapper getMapper() {
|
||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,24 @@ public class AnotherFakeApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To test special tags To test special tags and operation ID starting with number
|
* To test special tags To test special tags and operation ID starting with number
|
||||||
*
|
*
|
||||||
|
@ -23,13 +23,24 @@ public class DefaultApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return InlineResponseDefault
|
* @return InlineResponseDefault
|
||||||
* @throws ApiException if fails to make API call
|
* @throws ApiException if fails to make API call
|
||||||
|
@ -32,13 +32,24 @@ public class FakeApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Health check endpoint
|
* Health check endpoint
|
||||||
*
|
*
|
||||||
|
@ -23,13 +23,24 @@ public class FakeClassnameTags123Api {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To test class name in snake case To test class name in snake case
|
* To test class name in snake case To test class name in snake case
|
||||||
*
|
*
|
||||||
|
@ -25,13 +25,24 @@ public class PetApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
|
@ -23,13 +23,24 @@ public class StoreApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything
|
* Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything
|
||||||
* above 1000 or nonintegers will generate API errors
|
* above 1000 or nonintegers will generate API errors
|
||||||
|
@ -23,13 +23,24 @@ public class UserApi {
|
|||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the API cilent
|
||||||
|
*
|
||||||
|
* @return API client
|
||||||
|
*/
|
||||||
public ApiClient getApiClient() {
|
public ApiClient getApiClient() {
|
||||||
return apiClient;
|
return apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the API cilent
|
||||||
|
*
|
||||||
|
* @param apiClient an instance of API client
|
||||||
|
*/
|
||||||
public void setApiClient(ApiClient apiClient) {
|
public void setApiClient(ApiClient apiClient) {
|
||||||
this.apiClient = apiClient;
|
this.apiClient = apiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create user This can only be done by the logged in user.
|
* Create user This can only be done by the logged in user.
|
||||||
*
|
*
|
||||||
|
@ -15,26 +15,49 @@ package org.openapitools.client.model;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.ws.rs.core.GenericType;
|
import javax.ws.rs.core.GenericType;
|
||||||
|
|
||||||
|
/** Abstract class for oneOf,anyOf schemas defined in OpenAPI spec */
|
||||||
public abstract class AbstractOpenApiSchema {
|
public abstract class AbstractOpenApiSchema {
|
||||||
|
|
||||||
|
// store the actual instance of the schema/object
|
||||||
private Object instance;
|
private Object instance;
|
||||||
|
|
||||||
public final String schemaType;
|
// schema type (e.g. oneOf, anyOf)
|
||||||
|
private final String schemaType;
|
||||||
|
|
||||||
public AbstractOpenApiSchema(String schemaType) {
|
public AbstractOpenApiSchema(String schemaType) {
|
||||||
this.schemaType = schemaType;
|
this.schemaType = schemaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Get the list of schemas allowed to be stored in this object
|
||||||
|
*
|
||||||
|
* @return an instance of the actual schema/object
|
||||||
|
*/
|
||||||
public abstract Map<String, GenericType> getSchemas();
|
public abstract Map<String, GenericType> getSchemas();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Get the actual instance
|
||||||
|
*
|
||||||
|
* @return an instance of the actual schema/object
|
||||||
|
*/
|
||||||
public Object getActualInstance() {
|
public Object getActualInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Set the actual instance
|
||||||
|
*
|
||||||
|
* @param instance the actual instance of the schema/object
|
||||||
|
*/
|
||||||
public void setActualInstance(Object instance) {
|
public void setActualInstance(Object instance) {
|
||||||
this.instance = instance;
|
this.instance = instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * Get the schema type (e.g. anyOf, oneOf)
|
||||||
|
*
|
||||||
|
* @return the schema type
|
||||||
|
*/
|
||||||
public String getSchemaType() {
|
public String getSchemaType() {
|
||||||
return schemaType;
|
return schemaType;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user