forked from loafle/openapi-generator-original
add more tests such as empty response (#14587)
This commit is contained in:
@@ -20,6 +20,8 @@ src/main/java/org/openapitools/client/ServerConfiguration.java
|
||||
src/main/java/org/openapitools/client/ServerVariable.java
|
||||
src/main/java/org/openapitools/client/StringUtil.java
|
||||
src/main/java/org/openapitools/client/api/BodyApi.java
|
||||
src/main/java/org/openapitools/client/api/FormApi.java
|
||||
src/main/java/org/openapitools/client/api/HeaderApi.java
|
||||
src/main/java/org/openapitools/client/api/PathApi.java
|
||||
src/main/java/org/openapitools/client/api/QueryApi.java
|
||||
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
|
||||
|
||||
@@ -41,6 +41,64 @@ paths:
|
||||
tags:
|
||||
- path
|
||||
x-accepts: text/plain
|
||||
/form/integer/boolean/string:
|
||||
post:
|
||||
description: Test form parameter(s)
|
||||
operationId: test/form/integer/boolean/string
|
||||
requestBody:
|
||||
content:
|
||||
application/x-www-form-urlencoded:
|
||||
schema:
|
||||
$ref: '#/components/schemas/test_form_integer_boolean_string_request'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test form parameter(s)
|
||||
tags:
|
||||
- form
|
||||
x-content-type: application/x-www-form-urlencoded
|
||||
x-accepts: text/plain
|
||||
/header/integer/boolean/string:
|
||||
get:
|
||||
description: Test header parameter(s)
|
||||
operationId: test/header/integer/boolean/string
|
||||
parameters:
|
||||
- explode: true
|
||||
in: header
|
||||
name: integer_header
|
||||
required: false
|
||||
schema:
|
||||
type: integer
|
||||
style: form
|
||||
- explode: true
|
||||
in: header
|
||||
name: boolean_header
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
style: form
|
||||
- explode: true
|
||||
in: header
|
||||
name: string_header
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
style: form
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test header parameter(s)
|
||||
tags:
|
||||
- header
|
||||
x-accepts: text/plain
|
||||
/query/integer/boolean/string:
|
||||
get:
|
||||
description: Test query parameter(s)
|
||||
@@ -211,6 +269,24 @@ paths:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: application/json
|
||||
/echo/body/Pet/response_string:
|
||||
post:
|
||||
description: Test empty response body
|
||||
operationId: test/echo/body/Pet/response_string
|
||||
requestBody:
|
||||
$ref: '#/components/requestBodies/Pet'
|
||||
responses:
|
||||
"200":
|
||||
content:
|
||||
text/plain:
|
||||
schema:
|
||||
type: string
|
||||
description: Successful operation
|
||||
summary: Test empty response body
|
||||
tags:
|
||||
- body
|
||||
x-content-type: application/json
|
||||
x-accepts: text/plain
|
||||
components:
|
||||
requestBodies:
|
||||
Pet:
|
||||
@@ -372,6 +448,15 @@ components:
|
||||
allOf:
|
||||
- $ref: '#/components/schemas/DataQuery_allOf'
|
||||
- $ref: '#/components/schemas/Query'
|
||||
test_form_integer_boolean_string_request:
|
||||
properties:
|
||||
integer_form:
|
||||
type: integer
|
||||
boolean_form:
|
||||
type: boolean
|
||||
string_form:
|
||||
type: string
|
||||
type: object
|
||||
test_query_style_form_explode_true_array_string_query_object_parameter:
|
||||
properties:
|
||||
values:
|
||||
|
||||
@@ -44,4 +44,33 @@ public interface BodyApi extends ApiClient.Api {
|
||||
ApiResponse<Pet> testEchoBodyPetWithHttpInfo(Pet pet);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Test empty response body
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("POST /echo/body/Pet/response_string")
|
||||
@Headers({
|
||||
"Content-Type: application/json",
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testEchoBodyPetResponseString(Pet pet);
|
||||
|
||||
/**
|
||||
* Test empty response body
|
||||
* Similar to <code>testEchoBodyPetResponseString</code> but it also returns the http response headers .
|
||||
* Test empty response body
|
||||
* @param pet Pet object that needs to be added to the store (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("POST /echo/body/Pet/response_string")
|
||||
@Headers({
|
||||
"Content-Type: application/json",
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testEchoBodyPetResponseStringWithHttpInfo(Pet pet);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public interface FormApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Test form parameter(s)
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("POST /form/integer/boolean/string")
|
||||
@Headers({
|
||||
"Content-Type: application/x-www-form-urlencoded",
|
||||
"Accept: text/plain",
|
||||
})
|
||||
String testFormIntegerBooleanString(@Param("integer_form") Integer integerForm, @Param("boolean_form") Boolean booleanForm, @Param("string_form") String stringForm);
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
* Similar to <code>testFormIntegerBooleanString</code> but it also returns the http response headers .
|
||||
* Test form parameter(s)
|
||||
* @param integerForm (optional)
|
||||
* @param booleanForm (optional)
|
||||
* @param stringForm (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("POST /form/integer/boolean/string")
|
||||
@Headers({
|
||||
"Content-Type: application/x-www-form-urlencoded",
|
||||
"Accept: text/plain",
|
||||
})
|
||||
ApiResponse<String> testFormIntegerBooleanStringWithHttpInfo(@Param("integer_form") Integer integerForm, @Param("boolean_form") Boolean booleanForm, @Param("string_form") String stringForm);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.EncodingUtils;
|
||||
import org.openapitools.client.model.ApiResponse;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import feign.*;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
|
||||
public interface HeaderApi extends ApiClient.Api {
|
||||
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Test header parameter(s)
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @return String
|
||||
*/
|
||||
@RequestLine("GET /header/integer/boolean/string")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
"integer_header: {integerHeader}",
|
||||
|
||||
"boolean_header: {booleanHeader}",
|
||||
|
||||
"string_header: {stringHeader}"
|
||||
})
|
||||
String testHeaderIntegerBooleanString(@Param("integerHeader") Integer integerHeader, @Param("booleanHeader") Boolean booleanHeader, @Param("stringHeader") String stringHeader);
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
* Similar to <code>testHeaderIntegerBooleanString</code> but it also returns the http response headers .
|
||||
* Test header parameter(s)
|
||||
* @param integerHeader (optional)
|
||||
* @param booleanHeader (optional)
|
||||
* @param stringHeader (optional)
|
||||
* @return A ApiResponse that wraps the response boyd and the http headers.
|
||||
*/
|
||||
@RequestLine("GET /header/integer/boolean/string")
|
||||
@Headers({
|
||||
"Accept: text/plain",
|
||||
"integer_header: {integerHeader}",
|
||||
|
||||
"boolean_header: {booleanHeader}",
|
||||
|
||||
"string_header: {stringHeader}"
|
||||
})
|
||||
ApiResponse<String> testHeaderIntegerBooleanStringWithHttpInfo(@Param("integerHeader") Integer integerHeader, @Param("booleanHeader") Boolean booleanHeader, @Param("stringHeader") String stringHeader);
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for FormApi
|
||||
*/
|
||||
class FormApiTest {
|
||||
|
||||
private FormApi api;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
api = new ApiClient().buildClient(FormApi.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test form parameter(s)
|
||||
*
|
||||
* Test form parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testFormIntegerBooleanStringTest() {
|
||||
Integer integerForm = null;
|
||||
Boolean booleanForm = null;
|
||||
String stringForm = null;
|
||||
// String response = api.testFormIntegerBooleanString(integerForm, booleanForm, stringForm);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* API tests for HeaderApi
|
||||
*/
|
||||
class HeaderApiTest {
|
||||
|
||||
private HeaderApi api;
|
||||
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
api = new ApiClient().buildClient(HeaderApi.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test header parameter(s)
|
||||
*
|
||||
* Test header parameter(s)
|
||||
*/
|
||||
@Test
|
||||
void testHeaderIntegerBooleanStringTest() {
|
||||
Integer integerHeader = null;
|
||||
Boolean booleanHeader = null;
|
||||
String stringHeader = null;
|
||||
// String response = api.testHeaderIntegerBooleanString(integerHeader, booleanHeader, stringHeader);
|
||||
|
||||
// TODO: test validations
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user