Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !14442

[Java][okhttp-gson] add echo client test

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge java-okhttp-echo-test into master 2 years ago
  • Overview 1
  • Commits 4
  • Pipelines 0
  • Changes 68

Add echo client tests

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    Commit all changed files. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*. For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master (6.3.0) (minor release - breaking changes with fallbacks), 7.0.x (breaking changes without fallbacks)
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

cc @bbdouglas (2017/07) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) @karismann (2019/03) @Zomzog (2019/04) @lwlee2608 (2019/10)

Compare
  • master (base)

and
  • latest version
    6ad88f86
    4 commits, 2 years ago

68 files
+ 8787
- 0

    Preferences

    File browser
    Compare changes
.github/‎workflows‎
samples-java-client‎-echo-api-jdk8.yaml‎ +3 -0
bin/c‎onfigs‎
java-okhttp-gso‎n-echo-api.yaml‎ +8 -0
samples/client/…‎/java/okhttp-gson‎
.github/‎workflows‎
mave‎n.yml‎ +30 -0
.openapi-‎generator‎
FI‎LES‎ +52 -0
VER‎SION‎ +1 -0
a‎pi‎
openap‎i.yaml‎ +299 -0
do‎cs‎
Bir‎d.md‎ +14 -0
BirdAndCa‎tegory.md‎ +16 -0
BodyA‎pi.md‎ +71 -0
Categ‎ory.md‎ +14 -0
PathA‎pi.md‎ +73 -0
Pet‎.md‎ +28 -0
Query‎Api.md‎ +327 -0
Tag‎.md‎ +14 -0
TestQueryStyleFormExplodeTrueAr‎rayStringQueryObjectParameter.md‎ +13 -0
gradle/‎wrapper‎
gradle-wr‎apper.jar‎ +0 -0
gradle-wrapp‎er.properties‎ +5 -0
s‎rc‎
ma‎in‎
java/org/opena‎pitools/client‎
a‎pi‎
BodyAp‎i.java‎ +194 -0
PathAp‎i.java‎ +208 -0
QueryA‎pi.java‎ +699 -0
au‎th‎
ApiKeyA‎uth.java‎ +80 -0
Authentic‎ation.java‎ +36 -0
HttpBasic‎Auth.java‎ +57 -0
HttpBeare‎rAuth.java‎ +63 -0
mo‎del‎
AbstractOpenA‎piSchema.java‎ +149 -0
Bird‎.java‎ +237 -0
BirdAndCat‎egory.java‎ +298 -0
Catego‎ry.java‎ +234 -0
Pet.‎java‎ +452 -0
Tag.‎java‎ +234 -0
TestQueryStyleFormExplodeTrueArr‎ayStringQueryObjectParameter.java‎ +216 -0
ApiCallb‎ack.java‎ +62 -0
ApiClie‎nt.java‎ +1546 -0
ApiExcep‎tion.java‎ +166 -0
ApiRespo‎nse.java‎ +76 -0
Configura‎tion.java‎ +39 -0
GzipRequestIn‎terceptor.java‎ +85 -0
JSON‎.java‎ +406 -0
Pair‎.java‎ +57 -0
ProgressRequ‎estBody.java‎ +73 -0
ProgressResp‎onseBody.java‎ +70 -0
ServerConfig‎uration.java‎ +58 -0
ServerVar‎iable.java‎ +23 -0
StringU‎til.java‎ +83 -0
AndroidMa‎nifest.xml‎ +3 -0
test/java/org/op‎enapitools/client‎
a‎pi‎
BodyApiT‎est.java‎ +48 -0
PathApiT‎est.java‎ +48 -0
QueryApi‎Test.java‎ +108 -0
mo‎del‎
BirdAndCateg‎oryTest.java‎ +72 -0
BirdTe‎st.java‎ +56 -0
Category‎Test.java‎ +56 -0
PetTes‎t.java‎ +92 -0
TagTes‎t.java‎ +56 -0
TestQueryStyleFormExplodeTrueArray‎StringQueryObjectParameterTest.java‎ +50 -0
CustomT‎est.java‎ +129 -0
EchoServerResp‎onseParser.java‎ +51 -0
.giti‎gnore‎ +21 -0
.openapi-gen‎erator-ignore‎ +23 -0
.trav‎is.yml‎ +22 -0
READ‎ME.md‎ +147 -0
build.‎gradle‎ +168 -0
buil‎d.sbt‎ +28 -0
git_p‎ush.sh‎ +57 -0
gradle.p‎roperties‎ +6 -0
gra‎dlew‎ +234 -0
gradl‎ew.bat‎ +89 -0
pom‎.xml‎ +353 -0
setting‎s.gradle‎ +1 -0
.github/workflows/samples-java-client-echo-api-jdk8.yaml
+ 3
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE


@@ -5,10 +5,12 @@ on:
paths:
- samples/client/echo_api/java/apache-httpclient/**
- samples/client/echo_api/java/feign-gson/**
- samples/client/echo_api/java/okhttp-gson/**
pull_request:
paths:
- samples/client/echo_api/java/apache-httpclient/**
- samples/client/echo_api/java/feign-gson/**
- samples/client/echo_api/java/okhttp-gson/**
jobs:
build:
name: Build Java Client JDK8
@@ -20,6 +22,7 @@ jobs:
# clients
- samples/client/echo_api/java/apache-httpclient
- samples/client/echo_api/java/feign-gson
- samples/client/echo_api/java/okhttp-gson
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
bin/configs/java-okhttp-gson-echo-api.yaml 0 → 100644
+ 8
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

generatorName: java
outputDir: samples/client/echo_api/java/okhttp-gson
#library: okhttp-gson
inputSpec: modules/openapi-generator/src/test/resources/3_0/echo_api.yaml
templateDir: modules/openapi-generator/src/main/resources/Java
additionalProperties:
artifactId: echo-api-okhttp-gson
hideGenerationTimestamp: "true"
samples/client/echo_api/java/okhttp-gson/.github/workflows/maven.yml 0 → 100644
+ 30
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
#
# This file is auto-generated by OpenAPI Generator (https://openapi-generator.tech)
name: Java CI with Maven
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
name: Build Echo Server API
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8' ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --no-transfer-progress --file pom.xml
samples/client/echo_api/java/okhttp-gson/.openapi-generator/FILES 0 → 100644
+ 52
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

.github/workflows/maven.yml
.gitignore
.travis.yml
README.md
api/openapi.yaml
build.gradle
build.sbt
docs/Bird.md
docs/BirdAndCategory.md
docs/BodyApi.md
docs/Category.md
docs/PathApi.md
docs/Pet.md
docs/QueryApi.md
docs/Tag.md
docs/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.md
git_push.sh
gradle.properties
gradle/wrapper/gradle-wrapper.jar
gradle/wrapper/gradle-wrapper.properties
gradlew
gradlew.bat
pom.xml
settings.gradle
src/main/AndroidManifest.xml
src/main/java/org/openapitools/client/ApiCallback.java
src/main/java/org/openapitools/client/ApiClient.java
src/main/java/org/openapitools/client/ApiException.java
src/main/java/org/openapitools/client/ApiResponse.java
src/main/java/org/openapitools/client/Configuration.java
src/main/java/org/openapitools/client/GzipRequestInterceptor.java
src/main/java/org/openapitools/client/JSON.java
src/main/java/org/openapitools/client/Pair.java
src/main/java/org/openapitools/client/ProgressRequestBody.java
src/main/java/org/openapitools/client/ProgressResponseBody.java
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/PathApi.java
src/main/java/org/openapitools/client/api/QueryApi.java
src/main/java/org/openapitools/client/auth/ApiKeyAuth.java
src/main/java/org/openapitools/client/auth/Authentication.java
src/main/java/org/openapitools/client/auth/HttpBasicAuth.java
src/main/java/org/openapitools/client/auth/HttpBearerAuth.java
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
src/main/java/org/openapitools/client/model/Bird.java
src/main/java/org/openapitools/client/model/BirdAndCategory.java
src/main/java/org/openapitools/client/model/Category.java
src/main/java/org/openapitools/client/model/Pet.java
src/main/java/org/openapitools/client/model/Tag.java
src/main/java/org/openapitools/client/model/TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter.java
samples/client/echo_api/java/okhttp-gson/.openapi-generator/VERSION 0 → 100644
+ 1
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

6.3.0-SNAPSHOT
\ No newline at end of file
samples/client/echo_api/java/okhttp-gson/api/openapi.yaml 0 → 100644
+ 299
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

openapi: 3.0.3
info:
contact:
email: team@openapitools.org
description: Echo Server API
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
title: Echo Server API
version: 0.1.0
servers:
- url: http://localhost:3000/
paths:
/path/string/{path_string}/integer/{path_integer}:
get:
description: Test path parameter(s)
operationId: "tests/path/string/{path_string}/integer/{path_integer}"
parameters:
- explode: false
in: path
name: path_string
required: true
schema:
type: string
style: simple
- explode: false
in: path
name: path_integer
required: true
schema:
type: integer
style: simple
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test path parameter(s)
tags:
- path
x-accepts: text/plain
/query/integer/boolean/string:
get:
description: Test query parameter(s)
operationId: test/query/integer/boolean/string
parameters:
- explode: true
in: query
name: integer_query
required: false
schema:
type: integer
style: form
- explode: true
in: query
name: boolean_query
required: false
schema:
type: boolean
style: form
- explode: true
in: query
name: string_query
required: false
schema:
type: string
style: form
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
x-accepts: text/plain
/query/style_form/explode_true/array_string:
get:
description: Test query parameter(s)
operationId: test/query/style_form/explode_true/array_string
parameters:
- explode: true
in: query
name: query_object
required: false
schema:
$ref: '#/components/schemas/test_query_style_form_explode_true_array_string_query_object_parameter'
style: form
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
x-accepts: text/plain
/query/style_form/explode_true/object:
get:
description: Test query parameter(s)
operationId: test/query/style_form/explode_true/object
parameters:
- explode: true
in: query
name: query_object
required: false
schema:
$ref: '#/components/schemas/Pet'
style: form
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
x-accepts: text/plain
/query/style_deepObject/explode_true/object:
get:
description: Test query parameter(s)
operationId: test/query/style_deepObject/explode_true/object
parameters:
- explode: true
in: query
name: query_object
required: false
schema:
$ref: '#/components/schemas/Pet'
style: deepObject
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
x-accepts: text/plain
/query/style_deepObject/explode_true/object/allOf:
get:
description: Test query parameter(s)
operationId: test/query/style_deepObject/explode_true/object/allOf
parameters:
- explode: true
in: query
name: query_object
required: false
schema:
$ref: '#/components/schemas/BirdAndCategory'
style: deepObject
responses:
"200":
content:
text/plain:
schema:
type: string
description: Successful operation
summary: Test query parameter(s)
tags:
- query
x-accepts: text/plain
/echo/body/Pet:
post:
description: Test body parameter(s)
operationId: test/echo/body/Pet
requestBody:
$ref: '#/components/requestBodies/Pet'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Successful operation
summary: Test body parameter(s)
tags:
- body
x-content-type: application/json
x-accepts: application/json
components:
requestBodies:
Pet:
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
description: Pet object that needs to be added to the store
schemas:
Category:
example:
name: Dogs
id: 1
properties:
id:
example: 1
format: int64
type: integer
name:
example: Dogs
type: string
type: object
xml:
name: category
Tag:
example:
name: name
id: 0
properties:
id:
format: int64
type: integer
name:
type: string
type: object
xml:
name: tag
Pet:
example:
photoUrls:
- photoUrls
- photoUrls
name: doggie
id: 10
category:
name: Dogs
id: 1
tags:
- name: name
id: 0
- name: name
id: 0
status: available
properties:
id:
example: 10
format: int64
type: integer
name:
example: doggie
type: string
category:
$ref: '#/components/schemas/Category'
photoUrls:
items:
type: string
xml:
name: photoUrl
type: array
xml:
wrapped: true
tags:
items:
$ref: '#/components/schemas/Tag'
type: array
xml:
wrapped: true
status:
description: pet status in the store
enum:
- available
- pending
- sold
type: string
required:
- name
- photoUrls
type: object
xml:
name: pet
Bird:
properties:
size:
type: string
color:
type: string
type: object
BirdAndCategory:
allOf:
- $ref: '#/components/schemas/Bird'
- $ref: '#/components/schemas/Category'
test_query_style_form_explode_true_array_string_query_object_parameter:
properties:
values:
items:
type: string
type: array
type: object
samples/client/echo_api/java/okhttp-gson/docs/Bird.md 0 → 100644
+ 14
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# Bird
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**size** | **String** | | [optional] |
|**color** | **String** | | [optional] |
samples/client/echo_api/java/okhttp-gson/docs/BirdAndCategory.md 0 → 100644
+ 16
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# BirdAndCategory
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**size** | **String** | | [optional] |
|**color** | **String** | | [optional] |
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |
samples/client/echo_api/java/okhttp-gson/docs/BodyApi.md 0 → 100644
+ 71
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# BodyApi
All URIs are relative to *http://localhost:3000*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**testEchoBodyPet**](BodyApi.md#testEchoBodyPet) | **POST** /echo/body/Pet | Test body parameter(s) |
<a name="testEchoBodyPet"></a>
# **testEchoBodyPet**
> Pet testEchoBodyPet(pet)
Test body parameter(s)
Test body parameter(s)
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.BodyApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
BodyApi apiInstance = new BodyApi(defaultClient);
Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store
try {
Pet result = apiInstance.testEchoBodyPet(pet);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling BodyApi#testEchoBodyPet");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] |
### Return type
[**Pet**](Pet.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
samples/client/echo_api/java/okhttp-gson/docs/Category.md 0 → 100644
+ 14
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# Category
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | [optional] |
samples/client/echo_api/java/okhttp-gson/docs/PathApi.md 0 → 100644
+ 73
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# PathApi
All URIs are relative to *http://localhost:3000*
| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**testsPathStringPathStringIntegerPathInteger**](PathApi.md#testsPathStringPathStringIntegerPathInteger) | **GET** /path/string/{path_string}/integer/{path_integer} | Test path parameter(s) |
<a name="testsPathStringPathStringIntegerPathInteger"></a>
# **testsPathStringPathStringIntegerPathInteger**
> String testsPathStringPathStringIntegerPathInteger(pathString, pathInteger)
Test path parameter(s)
Test path parameter(s)
### Example
```java
// Import classes:
import org.openapitools.client.ApiClient;
import org.openapitools.client.ApiException;
import org.openapitools.client.Configuration;
import org.openapitools.client.models.*;
import org.openapitools.client.api.PathApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://localhost:3000");
PathApi apiInstance = new PathApi(defaultClient);
String pathString = "pathString_example"; // String |
Integer pathInteger = 56; // Integer |
try {
String result = apiInstance.testsPathStringPathStringIntegerPathInteger(pathString, pathInteger);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PathApi#testsPathStringPathStringIntegerPathInteger");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
```
### Parameters
| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **pathString** | **String**| | |
| **pathInteger** | **Integer**| | |
### Return type
**String**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Successful operation | - |
samples/client/echo_api/java/okhttp-gson/docs/Pet.md 0 → 100644
+ 28
- 0
  • View file @ 6ad88f86

  • Edit in single-file editor

  • Open in Web IDE

# Pet
## Properties
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**id** | **Long** | | [optional] |
|**name** | **String** | | |
|**category** | [**Category**](Category.md) | | [optional] |
|**photoUrls** | **List&lt;String&gt;** | | |
|**tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] |
|**status** | [**StatusEnum**](#StatusEnum) | pet status in the store | [optional] |
## Enum: StatusEnum
| Name | Value |
|---- | -----|
| AVAILABLE | &quot;available&quot; |
| PENDING | &quot;pending&quot; |
| SOLD | &quot;sold&quot; |
0 Assignees
None
Assign to
Reviewer
Jim Schubert's avatar
Jim Schubert
Request review from
Labels
2
Client: Java Enhancement: CI/Test
2
Client: Java Enhancement: CI/Test
    Assign labels
  • Manage project labels

Milestone
6.3.0
6.3.0 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
3
3 participants
Jim Schubert
Administrator
William Cheng
Reference: OpenAPITools/openapi-generator!14442
Source branch: java-okhttp-echo-test

Menu

Explore Projects Groups Snippets