forked from loafle/openapi-generator-original
CaseFormatLambda has been added, params for Rest-assured client has been refactored (#91)
This commit is contained in:
parent
e55ba567a9
commit
3b9a2a7c36
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
import static java.util.Collections.sort;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.BooleanUtils;
|
import org.apache.commons.lang3.BooleanUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openapitools.codegen.CliOption;
|
import org.openapitools.codegen.CliOption;
|
||||||
@ -32,6 +30,7 @@ import org.openapitools.codegen.SupportingFile;
|
|||||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||||
import org.openapitools.codegen.languages.features.GzipFeatures;
|
import org.openapitools.codegen.languages.features.GzipFeatures;
|
||||||
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
|
import org.openapitools.codegen.languages.features.PerformBeanValidationFeatures;
|
||||||
|
import org.openapitools.codegen.mustache.CaseFormatLambda;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -46,6 +45,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import static com.google.common.base.CaseFormat.LOWER_CAMEL;
|
||||||
|
import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE;
|
||||||
|
import static java.util.Collections.sort;
|
||||||
|
|
||||||
public class JavaClientCodegen extends AbstractJavaCodegen
|
public class JavaClientCodegen extends AbstractJavaCodegen
|
||||||
implements BeanValidationFeatures, PerformBeanValidationFeatures,
|
implements BeanValidationFeatures, PerformBeanValidationFeatures,
|
||||||
GzipFeatures {
|
GzipFeatures {
|
||||||
@ -283,6 +286,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen
|
|||||||
|
|
||||||
} else if (REST_ASSURED.equals(getLibrary())) {
|
} else if (REST_ASSURED.equals(getLibrary())) {
|
||||||
additionalProperties.put("gson", "true");
|
additionalProperties.put("gson", "true");
|
||||||
|
additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE));
|
||||||
apiTemplateFiles.put("api.mustache", ".java");
|
apiTemplateFiles.put("api.mustache", ".java");
|
||||||
supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java"));
|
supportingFiles.add(new SupportingFile("ResponseSpecBuilders.mustache", invokerFolder, "ResponseSpecBuilders.java"));
|
||||||
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
package org.openapitools.codegen.mustache;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import com.samskivert.mustache.Template;
|
||||||
|
import org.openapitools.codegen.CodegenConfig;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts text from CaseFormat to another CaseFormat
|
||||||
|
*
|
||||||
|
* Register:
|
||||||
|
* <pre>
|
||||||
|
* additionalProperties.put("convert", new CaseFormatLambda(LOWER_CAMEL, UPPER_UNDERSCORE));
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* Use:
|
||||||
|
* <pre>
|
||||||
|
* {{#convert}}{{name}}{{/convert}}
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public class CaseFormatLambda implements Mustache.Lambda {
|
||||||
|
private CodegenConfig generator = null;
|
||||||
|
|
||||||
|
private CaseFormat initialFormat;
|
||||||
|
private CaseFormat targetFormat;
|
||||||
|
|
||||||
|
public CaseFormatLambda(CaseFormat target, CaseFormat targetFormat) {
|
||||||
|
this.initialFormat = target;
|
||||||
|
this.targetFormat = targetFormat;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CaseFormatLambda generator(final CodegenConfig generator) {
|
||||||
|
this.generator = generator;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(Template.Fragment fragment, Writer writer) throws IOException {
|
||||||
|
String text = initialFormat.converterTo(targetFormat).convert(fragment.execute());
|
||||||
|
if (generator != null && generator.reservedWords().contains(text)) {
|
||||||
|
text = generator.escapeReservedWord(text);
|
||||||
|
}
|
||||||
|
writer.write(text);
|
||||||
|
}
|
||||||
|
}
|
@ -151,46 +151,54 @@ public class {{classname}} {
|
|||||||
{{/bodyParams}}
|
{{/bodyParams}}
|
||||||
{{#headerParams}}
|
{{#headerParams}}
|
||||||
|
|
||||||
|
public static final String {{#convert}}{{paramName}}{{/convert}}_HEADER = "{{baseName}}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public {{operationIdCamelCase}}Oper {{paramName}}Header(String {{paramName}}) {
|
public {{operationIdCamelCase}}Oper {{paramName}}Header(String {{paramName}}) {
|
||||||
reqSpec.addHeader("{{baseName}}", {{paramName}});
|
reqSpec.addHeader({{#convert}}{{paramName}}{{/convert}}_HEADER, {{paramName}});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/headerParams}}
|
{{/headerParams}}
|
||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
|
|
||||||
|
public static final String {{#convert}}{{paramName}}{{/convert}}_PATH = "{{baseName}}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public {{operationIdCamelCase}}Oper {{paramName}}Path(Object {{paramName}}) {
|
public {{operationIdCamelCase}}Oper {{paramName}}Path(Object {{paramName}}) {
|
||||||
reqSpec.addPathParam("{{baseName}}", {{paramName}});
|
reqSpec.addPathParam({{#convert}}{{paramName}}{{/convert}}_PATH, {{paramName}});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/pathParams}}
|
{{/pathParams}}
|
||||||
{{#queryParams}}
|
{{#queryParams}}
|
||||||
|
|
||||||
|
public static final String {{#convert}}{{paramName}}{{/convert}}_QUERY = "{{baseName}}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public {{operationIdCamelCase}}Oper {{paramName}}Query(Object... {{paramName}}) {
|
public {{operationIdCamelCase}}Oper {{paramName}}Query(Object... {{paramName}}) {
|
||||||
reqSpec.addQueryParam("{{baseName}}", {{paramName}});
|
reqSpec.addQueryParam({{#convert}}{{paramName}}{{/convert}}_QUERY, {{paramName}});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/queryParams}}
|
{{/queryParams}}
|
||||||
{{#formParams}}
|
{{#formParams}}
|
||||||
{{^isFile}}
|
{{^isFile}}
|
||||||
|
|
||||||
|
public static final String {{#convert}}{{paramName}}{{/convert}}_FORM = "{{baseName}}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
* @param {{paramName}} ({{dataType}}) {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public {{operationIdCamelCase}}Oper {{paramName}}Form(Object... {{paramName}}) {
|
public {{operationIdCamelCase}}Oper {{paramName}}Form(Object... {{paramName}}) {
|
||||||
reqSpec.addFormParam("{{baseName}}", {{paramName}});
|
reqSpec.addFormParam({{#convert}}{{paramName}}{{/convert}}_FORM, {{paramName}});
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
{{/isFile}}
|
{{/isFile}}
|
||||||
|
@ -463,12 +463,14 @@ public class FakeApi {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String QUERY_QUERY = "query";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param query (String) (required)
|
* @param query (String) (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestBodyWithQueryParamsOper queryQuery(Object... query) {
|
public TestBodyWithQueryParamsOper queryQuery(Object... query) {
|
||||||
reqSpec.addQueryParam("query", query);
|
reqSpec.addQueryParam(QUERY_QUERY, query);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,120 +623,146 @@ public class FakeApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String INTEGER_FORM = "integer";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer (Integer) None (optional, default to null)
|
* @param integer (Integer) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper integerForm(Object... integer) {
|
public TestEndpointParametersOper integerForm(Object... integer) {
|
||||||
reqSpec.addFormParam("integer", integer);
|
reqSpec.addFormParam(INTEGER_FORM, integer);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String INT32_FORM = "int32";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int32 (Integer) None (optional, default to null)
|
* @param int32 (Integer) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper int32Form(Object... int32) {
|
public TestEndpointParametersOper int32Form(Object... int32) {
|
||||||
reqSpec.addFormParam("int32", int32);
|
reqSpec.addFormParam(INT32_FORM, int32);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String INT64_FORM = "int64";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param int64 (Long) None (optional, default to null)
|
* @param int64 (Long) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper int64Form(Object... int64) {
|
public TestEndpointParametersOper int64Form(Object... int64) {
|
||||||
reqSpec.addFormParam("int64", int64);
|
reqSpec.addFormParam(INT64_FORM, int64);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String NUMBER_FORM = "number";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param number (BigDecimal) None (required)
|
* @param number (BigDecimal) None (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper numberForm(Object... number) {
|
public TestEndpointParametersOper numberForm(Object... number) {
|
||||||
reqSpec.addFormParam("number", number);
|
reqSpec.addFormParam(NUMBER_FORM, number);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String _FLOAT_FORM = "float";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _float (Float) None (optional, default to null)
|
* @param _float (Float) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper _floatForm(Object... _float) {
|
public TestEndpointParametersOper _floatForm(Object... _float) {
|
||||||
reqSpec.addFormParam("float", _float);
|
reqSpec.addFormParam(_FLOAT_FORM, _float);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String _DOUBLE_FORM = "double";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _double (Double) None (required)
|
* @param _double (Double) None (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper _doubleForm(Object... _double) {
|
public TestEndpointParametersOper _doubleForm(Object... _double) {
|
||||||
reqSpec.addFormParam("double", _double);
|
reqSpec.addFormParam(_DOUBLE_FORM, _double);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String STRING_FORM = "string";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string (String) None (optional, default to null)
|
* @param string (String) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper stringForm(Object... string) {
|
public TestEndpointParametersOper stringForm(Object... string) {
|
||||||
reqSpec.addFormParam("string", string);
|
reqSpec.addFormParam(STRING_FORM, string);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PATTERN_WITHOUT_DELIMITER_FORM = "pattern_without_delimiter";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param patternWithoutDelimiter (String) None (required)
|
* @param patternWithoutDelimiter (String) None (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper patternWithoutDelimiterForm(Object... patternWithoutDelimiter) {
|
public TestEndpointParametersOper patternWithoutDelimiterForm(Object... patternWithoutDelimiter) {
|
||||||
reqSpec.addFormParam("pattern_without_delimiter", patternWithoutDelimiter);
|
reqSpec.addFormParam(PATTERN_WITHOUT_DELIMITER_FORM, patternWithoutDelimiter);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String _BYTE_FORM = "byte";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _byte (byte[]) None (required)
|
* @param _byte (byte[]) None (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper _byteForm(Object... _byte) {
|
public TestEndpointParametersOper _byteForm(Object... _byte) {
|
||||||
reqSpec.addFormParam("byte", _byte);
|
reqSpec.addFormParam(_BYTE_FORM, _byte);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String DATE_FORM = "date";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param date (LocalDate) None (optional, default to null)
|
* @param date (LocalDate) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper dateForm(Object... date) {
|
public TestEndpointParametersOper dateForm(Object... date) {
|
||||||
reqSpec.addFormParam("date", date);
|
reqSpec.addFormParam(DATE_FORM, date);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String DATE_TIME_FORM = "dateTime";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param dateTime (OffsetDateTime) None (optional, default to null)
|
* @param dateTime (OffsetDateTime) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper dateTimeForm(Object... dateTime) {
|
public TestEndpointParametersOper dateTimeForm(Object... dateTime) {
|
||||||
reqSpec.addFormParam("dateTime", dateTime);
|
reqSpec.addFormParam(DATE_TIME_FORM, dateTime);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PASSWORD_FORM = "password";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param password (String) None (optional, default to null)
|
* @param password (String) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper passwordForm(Object... password) {
|
public TestEndpointParametersOper passwordForm(Object... password) {
|
||||||
reqSpec.addFormParam("password", password);
|
reqSpec.addFormParam(PASSWORD_FORM, password);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PARAM_CALLBACK_FORM = "callback";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param paramCallback (String) None (optional, default to null)
|
* @param paramCallback (String) None (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEndpointParametersOper paramCallbackForm(Object... paramCallback) {
|
public TestEndpointParametersOper paramCallbackForm(Object... paramCallback) {
|
||||||
reqSpec.addFormParam("callback", paramCallback);
|
reqSpec.addFormParam(PARAM_CALLBACK_FORM, paramCallback);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -814,75 +842,91 @@ public class FakeApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_HEADER_STRING_ARRAY_HEADER = "enum_header_string_array";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional)
|
* @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumHeaderStringArrayHeader(String enumHeaderStringArray) {
|
public TestEnumParametersOper enumHeaderStringArrayHeader(String enumHeaderStringArray) {
|
||||||
reqSpec.addHeader("enum_header_string_array", enumHeaderStringArray);
|
reqSpec.addHeader(ENUM_HEADER_STRING_ARRAY_HEADER, enumHeaderStringArray);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_HEADER_STRING_HEADER = "enum_header_string";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumHeaderString (String) Header parameter enum test (string) (optional, default to -efg)
|
* @param enumHeaderString (String) Header parameter enum test (string) (optional, default to -efg)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumHeaderStringHeader(String enumHeaderString) {
|
public TestEnumParametersOper enumHeaderStringHeader(String enumHeaderString) {
|
||||||
reqSpec.addHeader("enum_header_string", enumHeaderString);
|
reqSpec.addHeader(ENUM_HEADER_STRING_HEADER, enumHeaderString);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_QUERY_STRING_ARRAY_QUERY = "enum_query_string_array";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional)
|
* @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumQueryStringArrayQuery(Object... enumQueryStringArray) {
|
public TestEnumParametersOper enumQueryStringArrayQuery(Object... enumQueryStringArray) {
|
||||||
reqSpec.addQueryParam("enum_query_string_array", enumQueryStringArray);
|
reqSpec.addQueryParam(ENUM_QUERY_STRING_ARRAY_QUERY, enumQueryStringArray);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_QUERY_STRING_QUERY = "enum_query_string";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumQueryString (String) Query parameter enum test (string) (optional, default to -efg)
|
* @param enumQueryString (String) Query parameter enum test (string) (optional, default to -efg)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumQueryStringQuery(Object... enumQueryString) {
|
public TestEnumParametersOper enumQueryStringQuery(Object... enumQueryString) {
|
||||||
reqSpec.addQueryParam("enum_query_string", enumQueryString);
|
reqSpec.addQueryParam(ENUM_QUERY_STRING_QUERY, enumQueryString);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_QUERY_INTEGER_QUERY = "enum_query_integer";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumQueryInteger (Integer) Query parameter enum test (double) (optional)
|
* @param enumQueryInteger (Integer) Query parameter enum test (double) (optional)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumQueryIntegerQuery(Object... enumQueryInteger) {
|
public TestEnumParametersOper enumQueryIntegerQuery(Object... enumQueryInteger) {
|
||||||
reqSpec.addQueryParam("enum_query_integer", enumQueryInteger);
|
reqSpec.addQueryParam(ENUM_QUERY_INTEGER_QUERY, enumQueryInteger);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_QUERY_DOUBLE_QUERY = "enum_query_double";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumQueryDouble (Double) Query parameter enum test (double) (optional)
|
* @param enumQueryDouble (Double) Query parameter enum test (double) (optional)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumQueryDoubleQuery(Object... enumQueryDouble) {
|
public TestEnumParametersOper enumQueryDoubleQuery(Object... enumQueryDouble) {
|
||||||
reqSpec.addQueryParam("enum_query_double", enumQueryDouble);
|
reqSpec.addQueryParam(ENUM_QUERY_DOUBLE_QUERY, enumQueryDouble);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_FORM_STRING_ARRAY_FORM = "enum_form_string_array";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumFormStringArray (List<String>) Form parameter enum test (string array) (optional, default to $)
|
* @param enumFormStringArray (List<String>) Form parameter enum test (string array) (optional, default to $)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumFormStringArrayForm(Object... enumFormStringArray) {
|
public TestEnumParametersOper enumFormStringArrayForm(Object... enumFormStringArray) {
|
||||||
reqSpec.addFormParam("enum_form_string_array", enumFormStringArray);
|
reqSpec.addFormParam(ENUM_FORM_STRING_ARRAY_FORM, enumFormStringArray);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ENUM_FORM_STRING_FORM = "enum_form_string";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enumFormString (String) Form parameter enum test (string) (optional, default to -efg)
|
* @param enumFormString (String) Form parameter enum test (string) (optional, default to -efg)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestEnumParametersOper enumFormStringForm(Object... enumFormString) {
|
public TestEnumParametersOper enumFormStringForm(Object... enumFormString) {
|
||||||
reqSpec.addFormParam("enum_form_string", enumFormString);
|
reqSpec.addFormParam(ENUM_FORM_STRING_FORM, enumFormString);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,21 +1056,25 @@ public class FakeApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(GET, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PARAM_FORM = "param";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param param (String) field1 (required)
|
* @param param (String) field1 (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestJsonFormDataOper paramForm(Object... param) {
|
public TestJsonFormDataOper paramForm(Object... param) {
|
||||||
reqSpec.addFormParam("param", param);
|
reqSpec.addFormParam(PARAM_FORM, param);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PARAM2_FORM = "param2";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param param2 (String) field2 (required)
|
* @param param2 (String) field2 (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public TestJsonFormDataOper param2Form(Object... param2) {
|
public TestJsonFormDataOper param2Form(Object... param2) {
|
||||||
reqSpec.addFormParam("param2", param2);
|
reqSpec.addFormParam(PARAM2_FORM, param2);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,21 +196,25 @@ public class PetApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String API_KEY_HEADER = "api_key";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param apiKey (String) (optional)
|
* @param apiKey (String) (optional)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public DeletePetOper apiKeyHeader(String apiKey) {
|
public DeletePetOper apiKeyHeader(String apiKey) {
|
||||||
reqSpec.addHeader("api_key", apiKey);
|
reqSpec.addHeader(API_KEY_HEADER, apiKey);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PET_ID_PATH = "petId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param petId (Long) Pet id to delete (required)
|
* @param petId (Long) Pet id to delete (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public DeletePetOper petIdPath(Object petId) {
|
public DeletePetOper petIdPath(Object petId) {
|
||||||
reqSpec.addPathParam("petId", petId);
|
reqSpec.addPathParam(PET_ID_PATH, petId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,12 +285,14 @@ public class PetApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String STATUS_QUERY = "status";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param status (List<String>) Status values that need to be considered for filter (required)
|
* @param status (List<String>) Status values that need to be considered for filter (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public FindPetsByStatusOper statusQuery(Object... status) {
|
public FindPetsByStatusOper statusQuery(Object... status) {
|
||||||
reqSpec.addQueryParam("status", status);
|
reqSpec.addQueryParam(STATUS_QUERY, status);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -359,12 +365,14 @@ public class PetApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String TAGS_QUERY = "tags";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param tags (List<String>) Tags to filter by (required)
|
* @param tags (List<String>) Tags to filter by (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public FindPetsByTagsOper tagsQuery(Object... tags) {
|
public FindPetsByTagsOper tagsQuery(Object... tags) {
|
||||||
reqSpec.addQueryParam("tags", tags);
|
reqSpec.addQueryParam(TAGS_QUERY, tags);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,12 +443,14 @@ public class PetApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PET_ID_PATH = "petId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param petId (Long) ID of pet to return (required)
|
* @param petId (Long) ID of pet to return (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public GetPetByIdOper petIdPath(Object petId) {
|
public GetPetByIdOper petIdPath(Object petId) {
|
||||||
reqSpec.addPathParam("petId", petId);
|
reqSpec.addPathParam(PET_ID_PATH, petId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -571,30 +581,36 @@ public class PetApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(POST, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PET_ID_PATH = "petId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param petId (Long) ID of pet that needs to be updated (required)
|
* @param petId (Long) ID of pet that needs to be updated (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UpdatePetWithFormOper petIdPath(Object petId) {
|
public UpdatePetWithFormOper petIdPath(Object petId) {
|
||||||
reqSpec.addPathParam("petId", petId);
|
reqSpec.addPathParam(PET_ID_PATH, petId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String NAME_FORM = "name";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name (String) Updated name of the pet (optional, default to null)
|
* @param name (String) Updated name of the pet (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UpdatePetWithFormOper nameForm(Object... name) {
|
public UpdatePetWithFormOper nameForm(Object... name) {
|
||||||
reqSpec.addFormParam("name", name);
|
reqSpec.addFormParam(NAME_FORM, name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String STATUS_FORM = "status";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param status (String) Updated status of the pet (optional, default to null)
|
* @param status (String) Updated status of the pet (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UpdatePetWithFormOper statusForm(Object... status) {
|
public UpdatePetWithFormOper statusForm(Object... status) {
|
||||||
reqSpec.addFormParam("status", status);
|
reqSpec.addFormParam(STATUS_FORM, status);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -669,21 +685,25 @@ public class PetApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PET_ID_PATH = "petId";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param petId (Long) ID of pet to update (required)
|
* @param petId (Long) ID of pet to update (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UploadFileOper petIdPath(Object petId) {
|
public UploadFileOper petIdPath(Object petId) {
|
||||||
reqSpec.addPathParam("petId", petId);
|
reqSpec.addPathParam(PET_ID_PATH, petId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ADDITIONAL_METADATA_FORM = "additionalMetadata";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param additionalMetadata (String) Additional data to pass to server (optional, default to null)
|
* @param additionalMetadata (String) Additional data to pass to server (optional, default to null)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UploadFileOper additionalMetadataForm(Object... additionalMetadata) {
|
public UploadFileOper additionalMetadataForm(Object... additionalMetadata) {
|
||||||
reqSpec.addFormParam("additionalMetadata", additionalMetadata);
|
reqSpec.addFormParam(ADDITIONAL_METADATA_FORM, additionalMetadata);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,12 +109,14 @@ public class StoreApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ORDER_ID_PATH = "order_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param orderId (String) ID of the order that needs to be deleted (required)
|
* @param orderId (String) ID of the order that needs to be deleted (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public DeleteOrderOper orderIdPath(Object orderId) {
|
public DeleteOrderOper orderIdPath(Object orderId) {
|
||||||
reqSpec.addPathParam("order_id", orderId);
|
reqSpec.addPathParam(ORDER_ID_PATH, orderId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,12 +253,14 @@ public class StoreApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String ORDER_ID_PATH = "order_id";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param orderId (Long) ID of pet that needs to be fetched (required)
|
* @param orderId (Long) ID of pet that needs to be fetched (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public GetOrderByIdOper orderIdPath(Object orderId) {
|
public GetOrderByIdOper orderIdPath(Object orderId) {
|
||||||
reqSpec.addPathParam("order_id", orderId);
|
reqSpec.addPathParam(ORDER_ID_PATH, orderId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,12 +326,14 @@ public class UserApi {
|
|||||||
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
return handler.apply(RestAssured.given().spec(reqSpec.build()).expect().spec(respSpec.build()).when().request(DELETE, REQ_URI));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String USERNAME_PATH = "username";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username (String) The name that needs to be deleted (required)
|
* @param username (String) The name that needs to be deleted (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public DeleteUserOper usernamePath(Object username) {
|
public DeleteUserOper usernamePath(Object username) {
|
||||||
reqSpec.addPathParam("username", username);
|
reqSpec.addPathParam(USERNAME_PATH, username);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,12 +404,14 @@ public class UserApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String USERNAME_PATH = "username";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username (String) The name that needs to be fetched. Use user1 for testing. (required)
|
* @param username (String) The name that needs to be fetched. Use user1 for testing. (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public GetUserByNameOper usernamePath(Object username) {
|
public GetUserByNameOper usernamePath(Object username) {
|
||||||
reqSpec.addPathParam("username", username);
|
reqSpec.addPathParam(USERNAME_PATH, username);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,21 +483,25 @@ public class UserApi {
|
|||||||
return execute(handler).as(type);
|
return execute(handler).as(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String USERNAME_QUERY = "username";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username (String) The user name for login (required)
|
* @param username (String) The user name for login (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public LoginUserOper usernameQuery(Object... username) {
|
public LoginUserOper usernameQuery(Object... username) {
|
||||||
reqSpec.addQueryParam("username", username);
|
reqSpec.addQueryParam(USERNAME_QUERY, username);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String PASSWORD_QUERY = "password";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param password (String) The password for login in clear text (required)
|
* @param password (String) The password for login in clear text (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public LoginUserOper passwordQuery(Object... password) {
|
public LoginUserOper passwordQuery(Object... password) {
|
||||||
reqSpec.addQueryParam("password", password);
|
reqSpec.addQueryParam(PASSWORD_QUERY, password);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -620,12 +628,14 @@ public class UserApi {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final String USERNAME_PATH = "username";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username (String) name that need to be deleted (required)
|
* @param username (String) name that need to be deleted (required)
|
||||||
* @return operation
|
* @return operation
|
||||||
*/
|
*/
|
||||||
public UpdateUserOper usernamePath(Object username) {
|
public UpdateUserOper usernamePath(Object username) {
|
||||||
reqSpec.addPathParam("username", username);
|
reqSpec.addPathParam(USERNAME_PATH, username);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user