Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ export class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{
{{/vars}}

{{#discriminator}}
static discriminator = {{discriminator}};
static discriminator = '{{discriminator}}';
{{/discriminator}}
{{^discriminator}}
static discriminator = undefined;
static discriminator: string = undefined;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be

static discriminator: string | undefined = undefined;

so that it can pass CI. The same with all the rest of the spots with undefined assignments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bjarnij I checked this locally and it in fact does fix the issue:

{{#discriminator}}
static discriminator: string | undefined = "{{discriminator}}";
{{/discriminator}}
{{^discriminator}}
static discriminator: string | undefined = undefined;
{{/discriminator}}

{{/discriminator}}

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.4.0-SNAPSHOT
14 changes: 7 additions & 7 deletions samples/client/petstore/typescript-node/default/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class ApiResponse {
'type': string;
'message': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -175,7 +175,7 @@ export class Category {
'id': number;
'name': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -208,7 +208,7 @@ export class Order {
'status': Order.StatusEnum;
'complete': boolean;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -268,7 +268,7 @@ export class Pet {
*/
'status': Pet.StatusEnum;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -321,7 +321,7 @@ export class Tag {
'id': number;
'name': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -356,7 +356,7 @@ export class User {
*/
'userStatus': number;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -1507,7 +1507,7 @@ export class UserApi {
/**
*
* @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.4.0-SNAPSHOT
14 changes: 7 additions & 7 deletions samples/client/petstore/typescript-node/npm/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class ApiResponse {
'type': string;
'message': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -175,7 +175,7 @@ export class Category {
'id': number;
'name': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -208,7 +208,7 @@ export class Order {
'status': Order.StatusEnum;
'complete': boolean;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -268,7 +268,7 @@ export class Pet {
*/
'status': Pet.StatusEnum;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -321,7 +321,7 @@ export class Tag {
'id': number;
'name': string;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -356,7 +356,7 @@ export class User {
*/
'userStatus': number;

static discriminator = undefined;
static discriminator: string = undefined;

static attributeTypeMap: Array<{name: string, baseName: string, type: string}> = [
{
Expand Down Expand Up @@ -1507,7 +1507,7 @@ export class UserApi {
/**
*
* @summary Get user by user name
* @param username The name that needs to be fetched. Use user1 for testing.
* @param username The name that needs to be fetched. Use user1 for testing.
*/
public getUserByName (username: string) : Promise<{ response: http.ClientResponse; body: User; }> {
const localVarPath = this.basePath + '/user/{username}'
Expand Down