Closed joshuashaffer closed 4 years ago
@joshuashaffer - Thanks for contributing to the project! I renamed the title of the PR to make it more descriptive :)
Make an end point that is '/'. That's the test case.
On Tue, 5 Nov 2019 at 02:43, Marius Tennøe notifications@github.com wrote:
@mtennoe commented on this pull request.
In src/view-data/method.ts https://github.com/mtennoe/swagger-typescript-codegen/pull/105#discussion_r342415499 :
@@ -113,9 +113,10 @@ function getPathToMethodName(httpVerb: string, path: string): string { });
const result = camelCase(segments.join("-"));
- return `${httpVerb.toLowerCase()}${result[0].toUpperCase()}${result.substring(
- 1
- )}`;
- if(result.length > 0)
- return
${httpVerb.toLowerCase()}${result[0].toUpperCase()}${result.substring(1)}
;- else
- return "root";
We probably want to prefix the httpverb for the root path as well, as that is still possibly different
In src/view-data/method.ts https://github.com/mtennoe/swagger-typescript-codegen/pull/105#discussion_r342415740 :
@@ -113,9 +113,10 @@ function getPathToMethodName(httpVerb: string, path: string): string { });
const result = camelCase(segments.join("-"));
- return `${httpVerb.toLowerCase()}${result[0].toUpperCase()}${result.substring(
- 1
- )}`;
- if(result.length > 0)
Hm, were these changes done directly in the github editor? Seems like prettier hasnt run, so the formatting is off, as the prettified formatting should look something like:
if (result.length > 0) { return
${httpVerb.toLowerCase()}${result[0].toUpperCase()}${result.substring(1)}
; } else { return "root"; }
In src/view-data/method.ts https://github.com/mtennoe/swagger-typescript-codegen/pull/105#discussion_r342416477 :
@@ -113,9 +113,10 @@ function getPathToMethodName(httpVerb: string, path: string): string { });
const result = camelCase(segments.join("-"));
- return `${httpVerb.toLowerCase()}${result[0].toUpperCase()}${result.substring(
- 1
- )}`;
- if(result.length > 0)
Can we get some tests for the root case?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mtennoe/swagger-typescript-codegen/pull/105?email_source=notifications&email_token=ABK6WD6MOGCSWTDGVYLRXJTQSEP3FA5CNFSM4JITYJ52YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOCKI4RYA#pullrequestreview-311544032, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABK6WD5Y7NGXPQIDPKPLP23QSEP3FANCNFSM4JITYJ5Q .
Take it or leave it.
Handle case where '/' is an endpoint. Without this, result[0] will be undefined.
Microsoft Reviewers: Open in CodeFlow