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

Add an option to disable converting path params into camelCase #592

Open
Quatters opened this issue Aug 23, 2023 · 3 comments
Open

Add an option to disable converting path params into camelCase #592

Quatters opened this issue Aug 23, 2023 · 3 comments

Comments

@Quatters
Copy link

If I have a snake_case path param in original schema like

/some/{path_param}/:
    ...
    parameters:
    - name: path_param
      in: path
      required: true
      type: string

then it'll be converted into camelCase in generated route (using generateRouteTypes: true):

'/some/{path_param}/': {
    get: {
      params: {
        pathParam: number;
      };
      ...
    };
  }

I guess I found this place and I see that this behavior is hard-coded:

routeParam.name = _.camelCase(routeParam.name);

The problem is that in our project we don't want path params to be converted into camelCase. We expecting that they are stay as given by schema.

Would be nice to have an option for generateApi for disabling this converting. Something like

return generateApi({
  generateRouteTypes: true,
  pathParamsInCamelCase: false, // true by default for example
});
@vitalii-bilous-epa
Copy link

We also want this functionality. It would be great to use function for that, like with hooks

@nathanbrachotte
Copy link

Same here. Sad this behavior is by default. That makes the library unusable for us.

@climam
Copy link

climam commented Mar 19, 2024

This issue was introduced by a change created to solve this issue #460

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

No branches or pull requests

4 participants