-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add failing example of nullable subschema * Do not generate new subschemas when nullable * Generate client * Update go example schema/test
- Loading branch information
1 parent
028b38d
commit 71a7a82
Showing
16 changed files
with
715 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
generatorName: typescript-fetch | ||
outputDir: samples/client/petstore/typescript-fetch/builds/allOf-nullable | ||
inputSpec: modules/openapi-generator/src/test/resources/3_0/allOf-nullable.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/typescript-fetch |
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
40 changes: 40 additions & 0 deletions
40
modules/openapi-generator/src/test/resources/3_0/allOf-nullable.yaml
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,40 @@ | ||
openapi: 3.0.1 | ||
info: | ||
version: 1.0.0 | ||
title: Example | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://api.example.xyz/v1 | ||
paths: | ||
/person/display/{personId}: | ||
get: | ||
parameters: | ||
- name: personId | ||
in: path | ||
required: true | ||
description: The id of the person to retrieve | ||
schema: | ||
type: string | ||
operationId: list | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/club" | ||
components: | ||
schemas: | ||
club: | ||
properties: | ||
owner: | ||
allOf: | ||
- $ref: '#/components/schemas/owner' | ||
nullable: true | ||
|
||
owner: | ||
properties: | ||
name: | ||
type: string | ||
maxLength: 255 |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/typescript-fetch/builds/allOf-nullable/.openapi-generator-ignore
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,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# Use this file to prevent files from being overwritten by the generator. | ||
# The patterns follow closely to .gitignore or .dockerignore. | ||
|
||
# As an example, the C# client generator defines ApiClient.cs. | ||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: | ||
#ApiClient.cs | ||
|
||
# You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||
#foo/*/qux | ||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||
|
||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||
#foo/**/qux | ||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||
|
||
# You can also negate patterns with an exclamation (!). | ||
# For example, you can ignore all files in a docs folder with the file extension .md: | ||
#docs/*.md | ||
# Then explicitly reverse the ignore rule for a single file: | ||
#!docs/README.md |
7 changes: 7 additions & 0 deletions
7
samples/client/petstore/typescript-fetch/builds/allOf-nullable/.openapi-generator/FILES
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,7 @@ | ||
apis/DefaultApi.ts | ||
apis/index.ts | ||
index.ts | ||
models/Club.ts | ||
models/Owner.ts | ||
models/index.ts | ||
runtime.ts |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/typescript-fetch/builds/allOf-nullable/.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
6.2.1-SNAPSHOT |
62 changes: 62 additions & 0 deletions
62
samples/client/petstore/typescript-fetch/builds/allOf-nullable/apis/DefaultApi.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,62 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Example | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* 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 type { | ||
Club, | ||
} from '../models'; | ||
import { | ||
ClubFromJSON, | ||
ClubToJSON, | ||
} from '../models'; | ||
|
||
export interface ListRequest { | ||
personId: string; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class DefaultApi extends runtime.BaseAPI { | ||
|
||
/** | ||
*/ | ||
async listRaw(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Club>> { | ||
if (requestParameters.personId === null || requestParameters.personId === undefined) { | ||
throw new runtime.RequiredError('personId','Required parameter requestParameters.personId was null or undefined when calling list.'); | ||
} | ||
|
||
const queryParameters: any = {}; | ||
|
||
const headerParameters: runtime.HTTPHeaders = {}; | ||
|
||
const response = await this.request({ | ||
path: `/person/display/{personId}`.replace(`{${"personId"}}`, encodeURIComponent(String(requestParameters.personId))), | ||
method: 'GET', | ||
headers: headerParameters, | ||
query: queryParameters, | ||
}, initOverrides); | ||
|
||
return new runtime.JSONApiResponse(response, (jsonValue) => ClubFromJSON(jsonValue)); | ||
} | ||
|
||
/** | ||
*/ | ||
async list(requestParameters: ListRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Club> { | ||
const response = await this.listRaw(requestParameters, initOverrides); | ||
return await response.value(); | ||
} | ||
|
||
} |
3 changes: 3 additions & 0 deletions
3
samples/client/petstore/typescript-fetch/builds/allOf-nullable/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,3 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * from './DefaultApi'; |
5 changes: 5 additions & 0 deletions
5
samples/client/petstore/typescript-fetch/builds/allOf-nullable/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,5 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * from './runtime'; | ||
export * from './apis'; | ||
export * from './models'; |
72 changes: 72 additions & 0 deletions
72
samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Club.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,72 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Example | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* 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, mapValues } from '../runtime'; | ||
import type { Owner } from './Owner'; | ||
import { | ||
OwnerFromJSON, | ||
OwnerFromJSONTyped, | ||
OwnerToJSON, | ||
} from './Owner'; | ||
|
||
/** | ||
* | ||
* @export | ||
* @interface Club | ||
*/ | ||
export interface Club { | ||
/** | ||
* | ||
* @type {Owner} | ||
* @memberof Club | ||
*/ | ||
owner?: Owner | null; | ||
} | ||
|
||
/** | ||
* Check if a given object implements the Club interface. | ||
*/ | ||
export function instanceOfClub(value: object): boolean { | ||
let isInstance = true; | ||
|
||
return isInstance; | ||
} | ||
|
||
export function ClubFromJSON(json: any): Club { | ||
return ClubFromJSONTyped(json, false); | ||
} | ||
|
||
export function ClubFromJSONTyped(json: any, ignoreDiscriminator: boolean): Club { | ||
if ((json === undefined) || (json === null)) { | ||
return json; | ||
} | ||
return { | ||
|
||
'owner': !exists(json, 'owner') ? undefined : OwnerFromJSON(json['owner']), | ||
}; | ||
} | ||
|
||
export function ClubToJSON(value?: Club | null): any { | ||
if (value === undefined) { | ||
return undefined; | ||
} | ||
if (value === null) { | ||
return null; | ||
} | ||
return { | ||
|
||
'owner': OwnerToJSON(value.owner), | ||
}; | ||
} | ||
|
65 changes: 65 additions & 0 deletions
65
samples/client/petstore/typescript-fetch/builds/allOf-nullable/models/Owner.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,65 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Example | ||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* 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, mapValues } from '../runtime'; | ||
/** | ||
* | ||
* @export | ||
* @interface Owner | ||
*/ | ||
export interface Owner { | ||
/** | ||
* | ||
* @type {string} | ||
* @memberof Owner | ||
*/ | ||
name?: string; | ||
} | ||
|
||
/** | ||
* Check if a given object implements the Owner interface. | ||
*/ | ||
export function instanceOfOwner(value: object): boolean { | ||
let isInstance = true; | ||
|
||
return isInstance; | ||
} | ||
|
||
export function OwnerFromJSON(json: any): Owner { | ||
return OwnerFromJSONTyped(json, false); | ||
} | ||
|
||
export function OwnerFromJSONTyped(json: any, ignoreDiscriminator: boolean): Owner { | ||
if ((json === undefined) || (json === null)) { | ||
return json; | ||
} | ||
return { | ||
|
||
'name': !exists(json, 'name') ? undefined : json['name'], | ||
}; | ||
} | ||
|
||
export function OwnerToJSON(value?: Owner | null): any { | ||
if (value === undefined) { | ||
return undefined; | ||
} | ||
if (value === null) { | ||
return null; | ||
} | ||
return { | ||
|
||
'name': value.name, | ||
}; | ||
} | ||
|
4 changes: 4 additions & 0 deletions
4
samples/client/petstore/typescript-fetch/builds/allOf-nullable/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,4 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
export * from './Club'; | ||
export * from './Owner'; |
Oops, something went wrong.