Skip to content

Commit e19ccbe

Browse files
warmansvmasek
authored andcommitted
fix(api-client) args not using camel case in path
* Fix for args not using camel case in path * Regenerate test code * fixed lint errors * Removed redundant comment fixes #42
1 parent f588fed commit e19ccbe

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/parser.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ function parseMethods({paths, security, parameters}: Swagger): Method[] {
4848
),
4949
methodType: methodType.toUpperCase() as MethodType,
5050
parameters: transformParameters(operation.parameters, parameters || {}),
51-
// tslint:disable-next-line:no-invalid-template-strings
52-
path: pathName.replace(/{(.*?)}/g, '$${args.$1}'), // turn path interpolation `{this}` into string template `${this}
51+
// turn path interpolation `{this}` into string template `${args.this}
52+
path: pathName.replace(
53+
/{(.*?)}/g,
54+
(_: string, ...args: string[]): string => `\${args.${camelCase(args[0])}}`),
5355
response: prefixImportedModels(determineResponseType(operation.responses)),
5456
summaryLines: operation.description
5557
? (operation.description || '').split('\n')

tests/github/api/api-client.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7120,7 +7120,7 @@ export class APIClient {
71207120
},
71217121
options?: HttpOptions
71227122
): Observable<any> {
7123-
const path = `/repos/${args.owner}/${args.repo}/${args.archive_format}/${args.path}`;
7123+
const path = `/repos/${args.owner}/${args.repo}/${args.archiveFormat}/${args.path}`;
71247124
options = {...this.options, ...options};
71257125

71267126
if ('xGitHubMediaType' in args) {

0 commit comments

Comments
 (0)