Skip to content

Commit b8f5cdf

Browse files
committed
Generated samples for utility types
1 parent 7007105 commit b8f5cdf

File tree

20 files changed

+1323
-0
lines changed

20 files changed

+1323
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
generatorName: typescript-fetch
2+
outputDir: samples/client/petstore/typescript-fetch/builds/utility-types-without-runtime
3+
inputSpec: modules/openapi-generator/src/test/resources/3_1/issue_21317.yaml
4+
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
5+
typeMappings:
6+
object: Record<string, unknown>
7+
UserSummary: Pick<User, "email">
8+
additionalProperties:
9+
withoutRuntimeChecks: true
10+

bin/configs/typescript-fetch-utility-types.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@ generatorName: typescript-fetch
22
outputDir: samples/client/petstore/typescript-fetch/builds/utility-types
33
inputSpec: modules/openapi-generator/src/test/resources/3_1/issue_21317.yaml
44
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch
5+
typeMappings:
6+
object: Record<string, unknown>
7+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.openapi-generator-ignore
2+
apis/DefaultApi.ts
3+
apis/index.ts
4+
index.ts
5+
models/index.ts
6+
runtime.ts
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.14.0-SNAPSHOT
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Sample API
5+
* Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
6+
*
7+
* The version of the OpenAPI document: 1.0.0
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
16+
import * as runtime from '../runtime';
17+
import type {
18+
User,
19+
} from '../models/index';
20+
21+
/**
22+
*
23+
*/
24+
export class DefaultApi extends runtime.BaseAPI {
25+
26+
/**
27+
* Optional extended description in CommonMark or HTML.
28+
* Returns a list of users.
29+
*/
30+
async usersGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<User>> {
31+
const queryParameters: any = {};
32+
33+
const headerParameters: runtime.HTTPHeaders = {};
34+
35+
const response = await this.request({
36+
path: `/users`,
37+
method: 'GET',
38+
headers: headerParameters,
39+
query: queryParameters,
40+
}, initOverrides);
41+
42+
return new runtime.JSONApiResponse(response);
43+
}
44+
45+
/**
46+
* Optional extended description in CommonMark or HTML.
47+
* Returns a list of users.
48+
*/
49+
async usersGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<User> {
50+
const response = await this.usersGetRaw(initOverrides);
51+
return await response.value();
52+
}
53+
54+
/**
55+
* Optional extended description in CommonMark or HTML.
56+
* Returns a list of users.
57+
*/
58+
async usersSummaryGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Pick<User, "email">>> {
59+
const queryParameters: any = {};
60+
61+
const headerParameters: runtime.HTTPHeaders = {};
62+
63+
const response = await this.request({
64+
path: `/users/summary`,
65+
method: 'GET',
66+
headers: headerParameters,
67+
query: queryParameters,
68+
}, initOverrides);
69+
70+
return new runtime.JSONApiResponse(response);
71+
}
72+
73+
/**
74+
* Optional extended description in CommonMark or HTML.
75+
* Returns a list of users.
76+
*/
77+
async usersSummaryGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Pick<User, "email">> {
78+
const response = await this.usersSummaryGetRaw(initOverrides);
79+
return await response.value();
80+
}
81+
82+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
export * from './DefaultApi';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
export * from './runtime';
4+
export * from './apis/index';
5+
export * from './models/index';
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
*
5+
* @export
6+
* @interface User
7+
*/
8+
export interface User {
9+
/**
10+
* The user ID.
11+
* @type {number}
12+
* @memberof User
13+
*/
14+
id?: number;
15+
/**
16+
* The user name.
17+
* @type {string}
18+
* @memberof User
19+
*/
20+
name?: string;
21+
/**
22+
* The user email address.
23+
* @type {string}
24+
* @memberof User
25+
*/
26+
email?: string;
27+
/**
28+
*
29+
* @type {Record<string, unknown>}
30+
* @memberof User
31+
*/
32+
metadata?: Record<string, unknown>;
33+
}
34+
/**
35+
*
36+
* @export
37+
* @interface UserSummary
38+
*/
39+
export interface UserSummary {
40+
/**
41+
* The user name.
42+
* @type {string}
43+
* @memberof UserSummary
44+
*/
45+
name?: string;
46+
}

0 commit comments

Comments
 (0)