Skip to content

Commit fd4a229

Browse files
Fix api generation
1 parent 9eee5d7 commit fd4a229

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/models/api.model.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { camel } from 'case';
1+
import { camel, capital } from 'case';
22
import { ModelStore } from '../stores/model.store';
33
import { ApiURLModel } from './api-url.model';
44
import { PhysycalFile } from './entities';
55
import { ModelAttributessModel } from './model-attributes.model';
66

77
export class ApiModel implements PhysycalFile {
88
url: string;
9-
verb: string;
9+
_verb: string;
1010
childrens: ApiURLModel[];
1111
description?: string;
1212
example?: string;
@@ -57,6 +57,13 @@ export class ApiModel implements PhysycalFile {
5757
return this.response?.type || 'void';
5858
}
5959

60+
get verb(): string {
61+
return this._verb;
62+
}
63+
set verb(verb: string) {
64+
this._verb = capital(verb);
65+
}
66+
6067
constructor(url: string, verb: string) {
6168
this.url = url;
6269
this.verb = verb;

templates/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class {{groupName}}Service {
5050
requestBody: {{.}},{{/requestBodyType
5151
}}
5252
): Observable<{{ responseType }}> {
53-
return this.apiService.do{{action}}(
53+
return this.apiService.do{{verb}}(
5454
'{{{ url }}}',
5555
{{#queryParamsType}}uriOptions{{/queryParamsType}}{{^queryParamsType}}null{{/queryParamsType}},
5656
{{#requestBodyType}}requestBody{{/requestBodyType}}{{^requestBodyType}}null{{/requestBodyType}}

0 commit comments

Comments
 (0)