Skip to content

Commit 5dc44a7

Browse files
committed
#32 - ApiController generator fails when using custom Produces attribute
- test added
1 parent 2f52c1e commit 5dc44a7

File tree

25 files changed

+95
-74
lines changed

25 files changed

+95
-74
lines changed

Tests/WebApiController/ClientApp/src/app/date/models/date-array-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class DateArrayWrapper {
55
public id: string;
66
public dates: Date[];
77

8-
public constructor(init: Partial<DateArrayWrapper> = undefined) {
8+
public constructor(init?: Partial<DateArrayWrapper>) {
99
Object.assign(this, init);
1010
}
1111
}

Tests/WebApiController/ClientApp/src/app/date/models/date-model-array-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class DateModelArrayWrapper {
77
public id: string;
88
public models: DateModel[];
99

10-
public constructor(init: Partial<DateModelArrayWrapper> = undefined) {
10+
public constructor(init?: Partial<DateModelArrayWrapper>) {
1111
Object.assign(this, init);
1212
}
1313
}

Tests/WebApiController/ClientApp/src/app/date/models/date-model-wrapper-list-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { DateModelWrapper } from "./date-model-wrapper";
66
export class DateModelWrapperListWrapper {
77
public list: DateModelWrapper[];
88

9-
public constructor(init: Partial<DateModelWrapperListWrapper> = undefined) {
9+
public constructor(init?: Partial<DateModelWrapperListWrapper>) {
1010
Object.assign(this, init);
1111
}
1212
}

Tests/WebApiController/ClientApp/src/app/date/models/date-model-wrapper-with-date.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class DateModelWrapperWithDate {
88
public date: Date;
99
public model: DateModel;
1010

11-
public constructor(init: Partial<DateModelWrapperWithDate> = undefined) {
11+
public constructor(init?: Partial<DateModelWrapperWithDate>) {
1212
Object.assign(this, init);
1313
}
1414
}

Tests/WebApiController/ClientApp/src/app/date/models/date-model-wrapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class DateModelWrapper {
77
public id: string;
88
public model: DateModel;
99

10-
public constructor(init: Partial<DateModelWrapper> = undefined) {
10+
public constructor(init?: Partial<DateModelWrapper>) {
1111
Object.assign(this, init);
1212
}
1313
}

Tests/WebApiController/ClientApp/src/app/date/models/date-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class DateModel {
55
public id: string;
66
public date: Date;
77

8-
public constructor(init: Partial<DateModel> = undefined) {
8+
public constructor(init?: Partial<DateModel>) {
99
Object.assign(this, init);
1010
}
1111
}

Tests/WebApiController/ClientApp/src/app/date/services/date.service.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class DateService {
3030
this.http = http;
3131
}
3232

33-
public get(httpOptions: {} = undefined): Observable<Date> {
33+
public get(httpOptions?: {}): Observable<Date> {
3434
let subject = new Subject<Date>();
3535
this.http.get<Date>(this.serviceUrl + "/api/date/get", httpOptions).subscribe((result) => {
3636
subject.next(this.convertToDate(result));
@@ -39,7 +39,7 @@ export class DateService {
3939
return subject;
4040
}
4141

42-
public getArray(httpOptions: {} = undefined): Observable<Date[]> {
42+
public getArray(httpOptions?: {}): Observable<Date[]> {
4343
let subject = new Subject<Date[]>();
4444
this.http.get<Date[]>(this.serviceUrl + "/api/date/getarray", httpOptions).subscribe((result) => {
4545
subject.next(result.map((entry) => this.convertToDate(entry)));
@@ -48,7 +48,7 @@ export class DateService {
4848
return subject;
4949
}
5050

51-
public getList(httpOptions: {} = undefined): Observable<Date[]> {
51+
public getList(httpOptions?: {}): Observable<Date[]> {
5252
let subject = new Subject<Date[]>();
5353
this.http.get<Date[]>(this.serviceUrl + "/api/date/getlist", httpOptions).subscribe((result) => {
5454
subject.next(result.map((entry) => this.convertToDate(entry)));
@@ -57,7 +57,7 @@ export class DateService {
5757
return subject;
5858
}
5959

60-
public getEnumerable(httpOptions: {} = undefined): Observable<Date[]> {
60+
public getEnumerable(httpOptions?: {}): Observable<Date[]> {
6161
let subject = new Subject<Date[]>();
6262
this.http.get<Date[]>(this.serviceUrl + "/api/date/getenumerable", httpOptions).subscribe((result) => {
6363
subject.next(result.map((entry) => this.convertToDate(entry)));
@@ -66,7 +66,7 @@ export class DateService {
6666
return subject;
6767
}
6868

69-
public getComplex(httpOptions: {} = undefined): Observable<DateModel> {
69+
public getComplex(httpOptions?: {}): Observable<DateModel> {
7070
let subject = new Subject<DateModel>();
7171
this.http.get<DateModel>(this.serviceUrl + "/api/date/getcomplex", httpOptions).subscribe((result) => {
7272
if (result) {
@@ -78,7 +78,7 @@ export class DateService {
7878
return subject;
7979
}
8080

81-
public getComplexArray(httpOptions: {} = undefined): Observable<DateModel[]> {
81+
public getComplexArray(httpOptions?: {}): Observable<DateModel[]> {
8282
let subject = new Subject<DateModel[]>();
8383
this.http.get<DateModel[]>(this.serviceUrl + "/api/date/getcomplexarray", httpOptions).subscribe((result) => {
8484
if (result) {
@@ -92,7 +92,7 @@ export class DateService {
9292
return subject;
9393
}
9494

95-
public getComplexList(httpOptions: {} = undefined): Observable<DateModel[]> {
95+
public getComplexList(httpOptions?: {}): Observable<DateModel[]> {
9696
let subject = new Subject<DateModel[]>();
9797
this.http.get<DateModel[]>(this.serviceUrl + "/api/date/getcomplexlist", httpOptions).subscribe((result) => {
9898
if (result) {
@@ -106,7 +106,7 @@ export class DateService {
106106
return subject;
107107
}
108108

109-
public getComplexEnumerable(httpOptions: {} = undefined): Observable<DateModel[]> {
109+
public getComplexEnumerable(httpOptions?: {}): Observable<DateModel[]> {
110110
let subject = new Subject<DateModel[]>();
111111
this.http.get<DateModel[]>(this.serviceUrl + "/api/date/getcomplexenumerable", httpOptions).subscribe((result) => {
112112
if (result) {
@@ -120,7 +120,7 @@ export class DateService {
120120
return subject;
121121
}
122122

123-
public getWrappedArray(httpOptions: {} = undefined): Observable<DateArrayWrapper> {
123+
public getWrappedArray(httpOptions?: {}): Observable<DateArrayWrapper> {
124124
let subject = new Subject<DateArrayWrapper>();
125125
this.http.get<DateArrayWrapper>(this.serviceUrl + "/api/date/getwrappedarray", httpOptions).subscribe((result) => {
126126
subject.next(result);
@@ -129,7 +129,7 @@ export class DateService {
129129
return subject;
130130
}
131131

132-
public getWrappedModel(httpOptions: {} = undefined): Observable<DateModelWrapper> {
132+
public getWrappedModel(httpOptions?: {}): Observable<DateModelWrapper> {
133133
let subject = new Subject<DateModelWrapper>();
134134
this.http.get<DateModelWrapper>(this.serviceUrl + "/api/date/getwrappedmodel", httpOptions).subscribe((result) => {
135135
if (result) {
@@ -143,7 +143,7 @@ export class DateService {
143143
return subject;
144144
}
145145

146-
public getWrappedModelList(httpOptions: {} = undefined): Observable<DateModelWrapper[]> {
146+
public getWrappedModelList(httpOptions?: {}): Observable<DateModelWrapper[]> {
147147
let subject = new Subject<DateModelWrapper[]>();
148148
this.http.get<DateModelWrapper[]>(this.serviceUrl + "/api/date/getwrappedmodellist", httpOptions).subscribe((result) => {
149149
if (result) {
@@ -159,7 +159,7 @@ export class DateService {
159159
return subject;
160160
}
161161

162-
public getWrappedModelListWrapper(httpOptions: {} = undefined): Observable<DateModelWrapperListWrapper> {
162+
public getWrappedModelListWrapper(httpOptions?: {}): Observable<DateModelWrapperListWrapper> {
163163
let subject = new Subject<DateModelWrapperListWrapper>();
164164
this.http.get<DateModelWrapperListWrapper>(this.serviceUrl + "/api/date/getwrappedmodellistwrapper", httpOptions).subscribe((result) => {
165165
if (result) {
@@ -177,7 +177,7 @@ export class DateService {
177177
return subject;
178178
}
179179

180-
public getWrappedModelListWrapperList(httpOptions: {} = undefined): Observable<DateModelWrapperListWrapper[]> {
180+
public getWrappedModelListWrapperList(httpOptions?: {}): Observable<DateModelWrapperListWrapper[]> {
181181
let subject = new Subject<DateModelWrapperListWrapper[]>();
182182
this.http.get<DateModelWrapperListWrapper[]>(this.serviceUrl + "/api/date/getwrappedmodellistwrapperlist", httpOptions).subscribe((result) => {
183183
if (result) {
@@ -197,7 +197,7 @@ export class DateService {
197197
return subject;
198198
}
199199

200-
public getWrappedModelWithDate(httpOptions: {} = undefined): Observable<DateModelWrapperWithDate> {
200+
public getWrappedModelWithDate(httpOptions?: {}): Observable<DateModelWrapperWithDate> {
201201
let subject = new Subject<DateModelWrapperWithDate>();
202202
this.http.get<DateModelWrapperWithDate>(this.serviceUrl + "/api/date/getwrappedmodelwithdate", httpOptions).subscribe((result) => {
203203
if (result) {
@@ -212,7 +212,7 @@ export class DateService {
212212
return subject;
213213
}
214214

215-
public getWrappedModelArray(httpOptions: {} = undefined): Observable<DateModelArrayWrapper> {
215+
public getWrappedModelArray(httpOptions?: {}): Observable<DateModelArrayWrapper> {
216216
let subject = new Subject<DateModelArrayWrapper>();
217217
this.http.get<DateModelArrayWrapper>(this.serviceUrl + "/api/date/getwrappedmodelarray", httpOptions).subscribe((result) => {
218218
if (result) {
@@ -228,7 +228,7 @@ export class DateService {
228228
return subject;
229229
}
230230

231-
public post(date: Date, httpOptions: {} = undefined): Observable<void> {
231+
public post(date: Date, httpOptions?: {}): Observable<void> {
232232
let subject = new Subject<void>();
233233
this.http.post<void>(this.serviceUrl + "/api/date/post" + "?date=" + this.convertFromDate(date), httpOptions).subscribe(() => {
234234
subject.next();

Tests/WebApiController/ClientApp/src/app/edge-cases/services/edge-cases.service.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class EdgeCasesService {
2424
this.http = http;
2525
}
2626

27-
public get(subject: string, httpOptions: {} = undefined): Observable<void> {
27+
public get(subject: string, httpOptions?: {}): Observable<void> {
2828
let rxjsSubject = new Subject<void>();
2929
this.http.get<void>(this.serviceUrl + "/edgecases/get" + "?subject=" + this.convertAny(subject), httpOptions).subscribe(() => {
3030
rxjsSubject.next();
@@ -33,7 +33,7 @@ export class EdgeCasesService {
3333
return rxjsSubject;
3434
}
3535

36-
public post(subject: string, httpOptions: {} = undefined): Observable<void> {
36+
public post(subject: string, httpOptions?: {}): Observable<void> {
3737
let rxjsSubject = new Subject<void>();
3838
this.http.post<void>(this.serviceUrl + "/edgecases/post" + "?subject=" + this.convertAny(subject), httpOptions).subscribe(() => {
3939
rxjsSubject.next();
@@ -42,7 +42,7 @@ export class EdgeCasesService {
4242
return rxjsSubject;
4343
}
4444

45-
public cancelable(subject: string, httpOptions: {} = undefined): Observable<string[]> {
45+
public cancelable(subject: string, httpOptions?: {}): Observable<string[]> {
4646
let rxjsSubject = new Subject<string[]>();
4747
this.http.get<string[]>(this.serviceUrl + "/edgecases/cancelable" + "?subject=" + this.convertAny(subject), httpOptions).subscribe((result) => {
4848
rxjsSubject.next(result);
@@ -51,7 +51,7 @@ export class EdgeCasesService {
5151
return rxjsSubject;
5252
}
5353

54-
public string(httpOptions: {} = undefined): Observable<string> {
54+
public string(httpOptions?: {}): Observable<string> {
5555
let subject = new Subject<string>();
5656
httpOptions = { responseType: 'text', ...httpOptions};
5757
this.http.get<string>(this.serviceUrl + "/edgecases/string", httpOptions).subscribe((result) => {
@@ -61,7 +61,7 @@ export class EdgeCasesService {
6161
return subject;
6262
}
6363

64-
public getGuid(httpOptions: {} = undefined): Observable<string> {
64+
public getGuid(httpOptions?: {}): Observable<string> {
6565
let subject = new Subject<string>();
6666
this.http.get<string>(this.serviceUrl + "/edgecases/getguid", httpOptions).subscribe((result) => {
6767
subject.next(result.replace(/(^"|"$)/g, ""));
@@ -70,7 +70,7 @@ export class EdgeCasesService {
7070
return subject;
7171
}
7272

73-
public withDI(value: number, httpOptions: {} = undefined): Observable<boolean> {
73+
public withDI(value: number, httpOptions?: {}): Observable<boolean> {
7474
let subject = new Subject<boolean>();
7575
this.http.get<boolean>(this.serviceUrl + "/edgecases/withdi" + "?value=" + this.convertAny(value), httpOptions).subscribe((result) => {
7676
subject.next(result);
@@ -79,7 +79,7 @@ export class EdgeCasesService {
7979
return subject;
8080
}
8181

82-
public fromHeader(value: number = undefined, httpOptions: {} = undefined): Observable<string> {
82+
public fromHeader(httpOptions?: {}, value: number = undefined): Observable<string> {
8383
let subject = new Subject<string>();
8484
httpOptions = { responseType: 'text', ...httpOptions};
8585
this.http.get<string>(this.serviceUrl + "/edgecases/fromheader" + "?value=" + this.convertAny(value), httpOptions).subscribe((result) => {

Tests/WebApiController/ClientApp/src/app/fix-casing/models/casing-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class CasingModel {
99
public snakeCase: string;
1010
public upperSnakeCase: string;
1111

12-
public constructor(init: Partial<CasingModel> = undefined) {
12+
public constructor(init?: Partial<CasingModel>) {
1313
Object.assign(this, init);
1414
}
1515
}

Tests/WebApiController/ClientApp/src/app/fix-casing/services/fix-casing.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export class FixCasingService {
2525
this.http = http;
2626
}
2727

28-
public get(httpOptions: {} = undefined): Observable<CasingModel> {
28+
public get(httpOptions?: {}): Observable<CasingModel> {
2929
let subject = new Subject<CasingModel>();
3030
this.http.get<CasingModel>(this.serviceUrl + "/fixcasing", httpOptions).subscribe((result) => {
3131
subject.next(result);
@@ -34,7 +34,7 @@ export class FixCasingService {
3434
return subject;
3535
}
3636

37-
public post(model: CasingModel, httpOptions: {} = undefined): Observable<void> {
37+
public post(model: CasingModel, httpOptions?: {}): Observable<void> {
3838
let subject = new Subject<void>();
3939
this.http.post<void>(this.serviceUrl + "/fixcasing", model, httpOptions).subscribe(() => {
4040
subject.next();

0 commit comments

Comments
 (0)