Skip to content

Commit 05054a1

Browse files
committed
refactor(generator): parameter readonly typing
1 parent d00434a commit 05054a1

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/generator.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,36 +18,36 @@ export interface Definition {
1818
}
1919

2020
export interface MustacheData {
21-
readonly description: string,
22-
readonly isSecure: boolean,
23-
readonly swagger: Swagger,
24-
readonly domain: string,
25-
readonly methods: Method[],
26-
readonly definitions: Definition[]
21+
readonly description: string;
22+
readonly isSecure: boolean;
23+
readonly swagger: Swagger;
24+
readonly domain: string;
25+
readonly methods: Method[];
26+
readonly definitions: Definition[];
2727
}
2828

2929
export type TypescriptBasicTypes = 'string' | 'number' | 'boolean' | 'undefined' | 'any';
3030
export type In = 'body' | 'path' | 'query' | 'modelbinding' | 'header' | 'formData';
3131
export type MethodType = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
3232

3333
export interface Parameter {
34-
camelCaseName?: string;
35-
isArray?: boolean;
36-
isBodyParameter?: boolean;
37-
isFormParameter?: boolean;
38-
isHeaderParameter?: boolean;
39-
isPathParameter?: boolean;
40-
isPatternType?: boolean;
41-
isRef?: boolean;
42-
isQueryParameter?: boolean;
43-
isSingleton?: boolean;
44-
last?: boolean;
45-
'in'?: In;
46-
'enum'?: any[];
47-
items?: Parameter;
48-
name?: string,
49-
schema?: any,
50-
singleton?: any,
34+
readonly camelCaseName?: string;
35+
readonly isArray?: boolean;
36+
readonly isBodyParameter?: boolean;
37+
readonly isFormParameter?: boolean;
38+
readonly isHeaderParameter?: boolean;
39+
readonly isPathParameter?: boolean;
40+
readonly isPatternType?: boolean;
41+
readonly isRef?: boolean;
42+
readonly isQueryParameter?: boolean;
43+
readonly isSingleton?: boolean;
44+
readonly last?: boolean;
45+
readonly 'in'?: In;
46+
readonly 'enum'?: any[];
47+
readonly items?: Parameter;
48+
readonly name?: string,
49+
readonly schema?: any,
50+
readonly singleton?: any,
5151
type?: string,
5252
typescriptType?: TypescriptBasicTypes | string;
5353
}
@@ -61,7 +61,7 @@ export interface Method {
6161
readonly isSecure?: boolean; // currently unused TODO
6262
readonly parameters: Parameter[];
6363
readonly hasJsonResponse?: boolean; // if false, default toJson() should not be called TODO
64-
response?: string; // method return type // todo make readonly
64+
readonly response?: string; // method return type // todo make readonly
6565
}
6666

6767
export class Generator {
@@ -245,6 +245,7 @@ export class Generator {
245245

246246
private static transformParameters(parameters: Parameter[]): Parameter[] {
247247
return Array.isArray(parameters)
248+
// todo: required params
248249
? parameters.map((param) => {
249250
const parameter = {...param};
250251

@@ -367,4 +368,4 @@ export class Generator {
367368

368369
return data;
369370
}
370-
}
371+
}

0 commit comments

Comments
 (0)