-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Typescript][Fetch] Fix bugs with new typescript-fetch generator (#1545)
* [Typescript][Fetch] Always initialize queryParameters * [Typescript][Fetch] Resolve date and date-time formats to parameter type Date * [Typescript][Fetch] Update models template - Add `readonly` modifier to readOnly parameters. - Omit readOnly parameters from requests when serializing models - Use allVars in models template when serializing/deserializing requests * [Typescript][Fetch] Omit time component when parameter format: date * [Typescript][Fetch] Add moduleResolution: node option to tsconfig.json * [Typescript][Fetch] Added non-model enums
- Loading branch information
Showing
29 changed files
with
708 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
samples/client/petstore-security-test/typescript-fetch/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.1.2-SNAPSHOT | ||
4.0.0-SNAPSHOT |
61 changes: 61 additions & 0 deletions
61
samples/client/petstore-security-test/typescript-fetch/apis/FakeApi.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// tslint:disable | ||
/** | ||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- | ||
* | ||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
import * as runtime from '../runtime'; | ||
import { | ||
UNKNOWN_BASE_TYPE, | ||
UNKNOWN_BASE_TYPEFromJSON, | ||
UNKNOWN_BASE_TYPEToJSON, | ||
} from '../models'; | ||
|
||
export interface TestCodeInjectEndRnNRRequest { | ||
UNKNOWN_BASE_TYPE?: UNKNOWN_BASE_TYPE; | ||
} | ||
|
||
/** | ||
* no description | ||
*/ | ||
export class FakeApi extends runtime.BaseAPI { | ||
|
||
/** | ||
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
*/ | ||
async testCodeInjectEndRnNRRaw(requestParameters: TestCodeInjectEndRnNRRequest): Promise<runtime.ApiResponse<void>> { | ||
const queryParameters: runtime.HTTPQuery = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
headerParameters['Content-Type'] = 'application/json'; | ||
|
||
const response = await this.request({ | ||
path: `/fake`, | ||
method: 'PUT', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
body: UNKNOWN_BASE_TYPEToJSON(requestParameters.UNKNOWN_BASE_TYPE), | ||
}); | ||
|
||
return new runtime.VoidApiResponse(response); | ||
} | ||
|
||
/** | ||
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
* To test code injection *_/ ' \" =end -- \\r\\n \\n \\r | ||
*/ | ||
async testCodeInjectEndRnNR(requestParameters: TestCodeInjectEndRnNRRequest): Promise<void> { | ||
await this.testCodeInjectEndRnNRRaw(requestParameters); | ||
} | ||
|
||
} |
1 change: 1 addition & 0 deletions
1
samples/client/petstore-security-test/typescript-fetch/apis/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './FakeApi'; |
19 changes: 3 additions & 16 deletions
19
samples/client/petstore-security-test/typescript-fetch/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,3 @@ | ||
// tslint:disable | ||
/** | ||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- | ||
* | ||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
|
||
export * from "./api"; | ||
export * from "./configuration"; | ||
export * from './runtime'; | ||
export * from './apis'; | ||
export * from './models'; |
44 changes: 44 additions & 0 deletions
44
samples/client/petstore-security-test/typescript-fetch/models/Return.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// tslint:disable | ||
/** | ||
* OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r | ||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- | ||
* | ||
* OpenAPI spec version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r | ||
* Contact: something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
|
||
import { exists } from '../runtime'; | ||
/** | ||
* Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r | ||
* @export | ||
* @interface Return | ||
*/ | ||
export interface Return { | ||
/** | ||
* property description *_/ ' \" =end -- \\r\\n \\n \\r | ||
* @type {number} | ||
* @memberof Return | ||
*/ | ||
_return?: number; | ||
} | ||
|
||
export function ReturnFromJSON(json: any): Return { | ||
return { | ||
'_return': !exists(json, 'return') ? undefined : json['return'], | ||
}; | ||
} | ||
|
||
export function ReturnToJSON(value?: Return): any { | ||
if (value === undefined) { | ||
return undefined; | ||
} | ||
return { | ||
'return': value._return, | ||
}; | ||
} | ||
|
||
|
1 change: 1 addition & 0 deletions
1
samples/client/petstore-security-test/typescript-fetch/models/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './Return'; |
Oops, something went wrong.