Skip to content

Commit 8c54c26

Browse files
committed
More samples for jspecify
1 parent 2917ce8 commit 8c54c26

39 files changed

Lines changed: 2100 additions & 102 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>optionalDataType}} {{paramName}}{{/isPathParam}}
1+
{{#isPathParam}}{{#vendorExtensions.x-field-extra-annotation}}{{{.}}} {{/vendorExtensions.x-field-extra-annotation}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{>paramDoc}} @PathVariable("{{baseName}}"){{>dateTimeParam}}{{#isDeprecated}} @Deprecated{{/isDeprecated}} {{>nullableAnnotation}}{{>optionalDataType}} {{paramName}}{{/isPathParam}}

modules/openapi-generator/src/test/resources/3_0/java/jspecify.yaml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,41 @@ paths:
3939
multipart/form-data:
4040
schema:
4141
type: object
42+
required:
43+
- file
4244
properties:
4345
file:
4446
type: string
4547
format: binary
48+
metadata:
49+
type: string
50+
format: binary
4651
responses:
4752
default:
4853
description: ok
49-
54+
content:
55+
application/json:
56+
schema:
57+
properties:
58+
id:
59+
type: string
60+
format: uuid
61+
/download/{id}:
62+
get:
63+
parameters:
64+
- in: path
65+
name: id
66+
required: true
67+
schema:
68+
type: string
69+
responses:
70+
'200':
71+
description: ok
72+
content:
73+
application/octet-stream:
74+
schema:
75+
type: string
76+
format: binary
5077
components:
5178
schemas:
5279
Foo:

samples/client/petstore/java/native-jackson3-jspecify/.openapi-generator/FILES

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ build.gradle
77
build.sbt
88
docs/DefaultApi.md
99
docs/Foo.md
10+
docs/UploadPostDefaultResponse.md
1011
git_push.sh
1112
gradle.properties
1213
gradle/wrapper/gradle-wrapper.jar
@@ -31,5 +32,7 @@ src/main/java/org/openapitools/client/api/DefaultApi.java
3132
src/main/java/org/openapitools/client/api/package-info.java
3233
src/main/java/org/openapitools/client/model/AbstractOpenApiSchema.java
3334
src/main/java/org/openapitools/client/model/Foo.java
35+
src/main/java/org/openapitools/client/model/UploadPostDefaultResponse.java
3436
src/main/java/org/openapitools/client/model/package-info.java
3537
src/main/java/org/openapitools/client/package-info.java
38+
src/test/java/org/openapitools/client/model/UploadPostDefaultResponseTest.java

samples/client/petstore/java/native-jackson3-jspecify/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ public class DefaultApiExample {
8585
// Configure clients using the `defaultClient` object, such as
8686
// overriding the host and port, timeout, etc.
8787
DefaultApi apiInstance = new DefaultApi(defaultClient);
88-
java.time.Instant dtParam = new java.time.Instant(); // java.time.Instant |
89-
java.time.Instant dtQuery = new java.time.Instant(); // java.time.Instant |
90-
java.time.Instant dtCookie = new java.time.Instant(); // java.time.Instant |
88+
String id = "id_example"; // String |
9189
try {
92-
Foo result = apiInstance.fooDtParamGet(dtParam, dtQuery, dtCookie);
90+
File result = apiInstance.downloadIdGet(id);
9391
System.out.println(result);
9492
} catch (ApiException e) {
95-
System.err.println("Exception when calling DefaultApi#fooDtParamGet");
93+
System.err.println("Exception when calling DefaultApi#downloadIdGet");
9694
System.err.println("Status code: " + e.getCode());
9795
System.err.println("Reason: " + e.getResponseBody());
9896
System.err.println("Response headers: " + e.getResponseHeaders());
@@ -109,6 +107,8 @@ All URIs are relative to *http://localhost*
109107

110108
Class | Method | HTTP request | Description
111109
------------ | ------------- | ------------- | -------------
110+
*DefaultApi* | [**downloadIdGet**](docs/DefaultApi.md#downloadIdGet) | **GET** /download/{id} |
111+
*DefaultApi* | [**downloadIdGetWithHttpInfo**](docs/DefaultApi.md#downloadIdGetWithHttpInfo) | **GET** /download/{id} |
112112
*DefaultApi* | [**fooDtParamGet**](docs/DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} |
113113
*DefaultApi* | [**fooDtParamGetWithHttpInfo**](docs/DefaultApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} |
114114
*DefaultApi* | [**uploadPost**](docs/DefaultApi.md#uploadPost) | **POST** /upload |
@@ -118,6 +118,7 @@ Class | Method | HTTP request | Description
118118
## Documentation for Models
119119

120120
- [Foo](docs/Foo.md)
121+
- [UploadPostDefaultResponse](docs/UploadPostDefaultResponse.md)
121122

122123

123124
<a id="documentation-for-authorization"></a>

samples/client/petstore/java/native-jackson3-jspecify/api/openapi.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,34 @@ paths:
5252
description: file
5353
responses:
5454
default:
55+
content:
56+
application/json:
57+
schema:
58+
$ref: "#/components/schemas/_upload_post_default_response"
5559
description: ok
5660
x-content-type: multipart/form-data
5761
x-accepts:
5862
- application/json
63+
/download/{id}:
64+
get:
65+
parameters:
66+
- explode: false
67+
in: path
68+
name: id
69+
required: true
70+
schema:
71+
type: string
72+
style: simple
73+
responses:
74+
"200":
75+
content:
76+
application/octet-stream:
77+
schema:
78+
format: binary
79+
type: string
80+
description: ok
81+
x-accepts:
82+
- application/octet-stream
5983
components:
6084
schemas:
6185
Foo:
@@ -100,5 +124,17 @@ components:
100124
file:
101125
format: binary
102126
type: string
127+
metadata:
128+
format: binary
129+
type: string
130+
required:
131+
- file
103132
type: object
133+
_upload_post_default_response:
134+
example:
135+
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
136+
properties:
137+
id:
138+
format: uuid
139+
type: string
104140

samples/client/petstore/java/native-jackson3-jspecify/docs/DefaultApi.md

Lines changed: 148 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,145 @@ All URIs are relative to *http://localhost*
44

55
| Method | HTTP request | Description |
66
|------------- | ------------- | -------------|
7+
| [**downloadIdGet**](DefaultApi.md#downloadIdGet) | **GET** /download/{id} | |
8+
| [**downloadIdGetWithHttpInfo**](DefaultApi.md#downloadIdGetWithHttpInfo) | **GET** /download/{id} | |
79
| [**fooDtParamGet**](DefaultApi.md#fooDtParamGet) | **GET** /foo/{dtParam} | |
810
| [**fooDtParamGetWithHttpInfo**](DefaultApi.md#fooDtParamGetWithHttpInfo) | **GET** /foo/{dtParam} | |
911
| [**uploadPost**](DefaultApi.md#uploadPost) | **POST** /upload | |
1012
| [**uploadPostWithHttpInfo**](DefaultApi.md#uploadPostWithHttpInfo) | **POST** /upload | |
1113

1214

1315

16+
## downloadIdGet
17+
18+
> File downloadIdGet(id)
19+
20+
21+
22+
### Example
23+
24+
```java
25+
// Import classes:
26+
import org.openapitools.client.ApiClient;
27+
import org.openapitools.client.ApiException;
28+
import org.openapitools.client.Configuration;
29+
import org.openapitools.client.models.*;
30+
import org.openapitools.client.api.DefaultApi;
31+
32+
public class Example {
33+
public static void main(String[] args) {
34+
ApiClient defaultClient = Configuration.getDefaultApiClient();
35+
defaultClient.setBasePath("http://localhost");
36+
37+
DefaultApi apiInstance = new DefaultApi(defaultClient);
38+
String id = "id_example"; // String |
39+
try {
40+
File result = apiInstance.downloadIdGet(id);
41+
System.out.println(result);
42+
} catch (ApiException e) {
43+
System.err.println("Exception when calling DefaultApi#downloadIdGet");
44+
System.err.println("Status code: " + e.getCode());
45+
System.err.println("Reason: " + e.getResponseBody());
46+
System.err.println("Response headers: " + e.getResponseHeaders());
47+
e.printStackTrace();
48+
}
49+
}
50+
}
51+
```
52+
53+
### Parameters
54+
55+
56+
| Name | Type | Description | Notes |
57+
|------------- | ------------- | ------------- | -------------|
58+
| **id** | **String**| | |
59+
60+
### Return type
61+
62+
[**File**](File.md)
63+
64+
65+
### Authorization
66+
67+
No authorization required
68+
69+
### HTTP request headers
70+
71+
- **Content-Type**: Not defined
72+
- **Accept**: application/octet-stream
73+
74+
### HTTP response details
75+
| Status code | Description | Response headers |
76+
|-------------|-------------|------------------|
77+
| **200** | ok | - |
78+
79+
## downloadIdGetWithHttpInfo
80+
81+
> ApiResponse<File> downloadIdGetWithHttpInfo(id)
82+
83+
84+
85+
### Example
86+
87+
```java
88+
// Import classes:
89+
import org.openapitools.client.ApiClient;
90+
import org.openapitools.client.ApiException;
91+
import org.openapitools.client.ApiResponse;
92+
import org.openapitools.client.Configuration;
93+
import org.openapitools.client.models.*;
94+
import org.openapitools.client.api.DefaultApi;
95+
96+
public class Example {
97+
public static void main(String[] args) {
98+
ApiClient defaultClient = Configuration.getDefaultApiClient();
99+
defaultClient.setBasePath("http://localhost");
100+
101+
DefaultApi apiInstance = new DefaultApi(defaultClient);
102+
String id = "id_example"; // String |
103+
try {
104+
ApiResponse<File> response = apiInstance.downloadIdGetWithHttpInfo(id);
105+
System.out.println("Status code: " + response.getStatusCode());
106+
System.out.println("Response headers: " + response.getHeaders());
107+
System.out.println("Response body: " + response.getData());
108+
} catch (ApiException e) {
109+
System.err.println("Exception when calling DefaultApi#downloadIdGet");
110+
System.err.println("Status code: " + e.getCode());
111+
System.err.println("Response headers: " + e.getResponseHeaders());
112+
System.err.println("Reason: " + e.getResponseBody());
113+
e.printStackTrace();
114+
}
115+
}
116+
}
117+
```
118+
119+
### Parameters
120+
121+
122+
| Name | Type | Description | Notes |
123+
|------------- | ------------- | ------------- | -------------|
124+
| **id** | **String**| | |
125+
126+
### Return type
127+
128+
ApiResponse<[**File**](File.md)>
129+
130+
131+
### Authorization
132+
133+
No authorization required
134+
135+
### HTTP request headers
136+
137+
- **Content-Type**: Not defined
138+
- **Accept**: application/octet-stream
139+
140+
### HTTP response details
141+
| Status code | Description | Response headers |
142+
|-------------|-------------|------------------|
143+
| **200** | ok | - |
144+
145+
14146
## fooDtParamGet
15147

16148
> Foo fooDtParamGet(dtParam, dtQuery, dtCookie)
@@ -151,7 +283,7 @@ No authorization required
151283

152284
## uploadPost
153285

154-
> void uploadPost(_file)
286+
> UploadPostDefaultResponse uploadPost(_file, metadata)
155287
156288

157289

@@ -172,8 +304,10 @@ public class Example {
172304

173305
DefaultApi apiInstance = new DefaultApi(defaultClient);
174306
File _file = new File("/path/to/file"); // File |
307+
File metadata = new File("/path/to/file"); // File |
175308
try {
176-
apiInstance.uploadPost(_file);
309+
UploadPostDefaultResponse result = apiInstance.uploadPost(_file, metadata);
310+
System.out.println(result);
177311
} catch (ApiException e) {
178312
System.err.println("Exception when calling DefaultApi#uploadPost");
179313
System.err.println("Status code: " + e.getCode());
@@ -190,12 +324,13 @@ public class Example {
190324

191325
| Name | Type | Description | Notes |
192326
|------------- | ------------- | ------------- | -------------|
193-
| **_file** | **File**| | [optional] |
327+
| **_file** | **File**| | |
328+
| **metadata** | **File**| | [optional] |
194329

195330
### Return type
196331

332+
[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md)
197333

198-
null (empty response body)
199334

200335
### Authorization
201336

@@ -204,7 +339,7 @@ No authorization required
204339
### HTTP request headers
205340

206341
- **Content-Type**: multipart/form-data
207-
- **Accept**: Not defined
342+
- **Accept**: application/json
208343

209344
### HTTP response details
210345
| Status code | Description | Response headers |
@@ -213,7 +348,7 @@ No authorization required
213348

214349
## uploadPostWithHttpInfo
215350

216-
> ApiResponse<Void> uploadPostWithHttpInfo(_file)
351+
> ApiResponse<UploadPostDefaultResponse> uploadPostWithHttpInfo(_file, metadata)
217352
218353

219354

@@ -235,10 +370,12 @@ public class Example {
235370

236371
DefaultApi apiInstance = new DefaultApi(defaultClient);
237372
File _file = new File("/path/to/file"); // File |
373+
File metadata = new File("/path/to/file"); // File |
238374
try {
239-
ApiResponse<Void> response = apiInstance.uploadPostWithHttpInfo(_file);
375+
ApiResponse<UploadPostDefaultResponse> response = apiInstance.uploadPostWithHttpInfo(_file, metadata);
240376
System.out.println("Status code: " + response.getStatusCode());
241377
System.out.println("Response headers: " + response.getHeaders());
378+
System.out.println("Response body: " + response.getData());
242379
} catch (ApiException e) {
243380
System.err.println("Exception when calling DefaultApi#uploadPost");
244381
System.err.println("Status code: " + e.getCode());
@@ -255,12 +392,13 @@ public class Example {
255392

256393
| Name | Type | Description | Notes |
257394
|------------- | ------------- | ------------- | -------------|
258-
| **_file** | **File**| | [optional] |
395+
| **_file** | **File**| | |
396+
| **metadata** | **File**| | [optional] |
259397

260398
### Return type
261399

400+
ApiResponse<[**UploadPostDefaultResponse**](UploadPostDefaultResponse.md)>
262401

263-
ApiResponse<Void>
264402

265403
### Authorization
266404

@@ -269,7 +407,7 @@ No authorization required
269407
### HTTP request headers
270408

271409
- **Content-Type**: multipart/form-data
272-
- **Accept**: Not defined
410+
- **Accept**: application/json
273411

274412
### HTTP response details
275413
| Status code | Description | Response headers |

0 commit comments

Comments
 (0)