-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(typescript): Support retainOriginalName/noSerdeLayer in inline p…
…ath parameters (#5427) Support retainOriginalName/noSerdeLayer in inline path parameters in TS SDK
- Loading branch information
1 parent
00476af
commit 2ae45d4
Showing
554 changed files
with
39,843 additions
and
698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.44.1 | ||
0.44.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 0 additions & 14 deletions
14
...script/sdk/client-class-generator/src/endpoints/utils/getParameterNameForPathParameter.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
generators/typescript/utils/commons/src/codegen-utils/getParameterNameForPathParameter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import { Name, PathParameter } from "@fern-fern/ir-sdk/api"; | ||
|
||
/** | ||
* Determines the casing of the path parameter when used as a positional function parameter | ||
*/ | ||
export function getParameterNameForPositionalPathParameter({ | ||
pathParameter, | ||
retainOriginalCasing | ||
}: { | ||
pathParameter: PathParameter; | ||
retainOriginalCasing: boolean; | ||
}): string { | ||
return getParameterNameForPathParameterInternalName({ | ||
pathParameterName: pathParameter.name, | ||
retainOriginalCasing | ||
}); | ||
} | ||
|
||
/** | ||
* Determines the casing of the root path parameter which is put into the client class options class | ||
*/ | ||
export function getParameterNameForRootPathParameter({ | ||
pathParameter, | ||
retainOriginalCasing | ||
}: { | ||
pathParameter: PathParameter; | ||
retainOriginalCasing: boolean; | ||
}): string { | ||
if (pathParameter.location !== "ROOT") { | ||
throw new Error("pathParameter.location must be ROOT"); | ||
} | ||
return getParameterNameForPathParameterInternalName({ | ||
pathParameterName: pathParameter.name, | ||
retainOriginalCasing | ||
}); | ||
} | ||
|
||
/** | ||
* Determines the casing of the path parameter when used as a parameter inside an object/interface | ||
*/ | ||
export function getParameterNameForPropertyPathParameter({ | ||
pathParameter, | ||
retainOriginalCasing, | ||
includeSerdeLayer | ||
}: { | ||
pathParameter: PathParameter; | ||
retainOriginalCasing: boolean; | ||
includeSerdeLayer: boolean; | ||
}): string { | ||
return getParameterNameForPropertyPathParameterName({ | ||
pathParameterName: pathParameter.name, | ||
retainOriginalCasing, | ||
includeSerdeLayer | ||
}); | ||
} | ||
|
||
/** | ||
* Determines the casing of the path parameter when used as a parameter inside an object/interface | ||
*/ | ||
export function getParameterNameForPropertyPathParameterName({ | ||
pathParameterName, | ||
retainOriginalCasing, | ||
includeSerdeLayer | ||
}: { | ||
pathParameterName: Name; | ||
retainOriginalCasing: boolean; | ||
includeSerdeLayer: boolean; | ||
}): string { | ||
return getParameterNameForPathParameterInternalName({ | ||
pathParameterName, | ||
retainOriginalCasing: retainOriginalCasing || !includeSerdeLayer | ||
}); | ||
} | ||
|
||
function getParameterNameForPathParameterInternalName({ | ||
pathParameterName, | ||
retainOriginalCasing | ||
}: { | ||
pathParameterName: Name; | ||
retainOriginalCasing: boolean; | ||
}): string { | ||
if (retainOriginalCasing) { | ||
return pathParameterName.originalName; | ||
} | ||
return pathParameterName.camelCase.safeName; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.