Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Orders method parameters by path instead of alphabetically. #4979

Open
BlueBeret opened this issue Oct 22, 2024 · 0 comments
Open

Comments

@BlueBeret
Copy link

Problem description

I was wondering why Fern orders method parameters alphabetically. Wouldn't it make more sense to order them by the path?

For example, given an API with the path /api/v1/orgs/{org}/folder/{folder}/file/{file}/, Fern generates a method like getSomething(file, folder, org). Wouldn't it make more sense to have the arguments ordered as getSomething(org, folder, file) instead?

Why would it be useful?

Ordering parameters by the path would align the method signature with the logical flow of the API structure. This can make the code more intuitive for developers to read and understand, especially when dealing with APIs that reflect a hierarchical or domain-specific structure. It can also prevent confusion and reduce the learning curve when working across multiple endpoints.

Or even better, the method could use keyword arguments (kwargs) or a dictionary-like approach, such as doSomething(props), where the arguments would be passed as doSomething({org: 1, folder: 2, file: 3}). This would further enhance flexibility and clarity, especially as the number of parameters grows.

Describe the solution (optional)

A possible solution could be to provide an option in the SDK configuration to allow users to choose whether to order parameters alphabetically or based on their order in the API path. Another option would be to allow the use of keyword arguments or a dictionary approach, which would give more flexibility when passing parameters.

Additional context

name: fernapi/fern-typescript-node-sdk
version: 0.41.0-rc1

slack discussion: chat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant