Skip to content

Version 13.0.10 doesn't respect onInsertPathParam hook #806

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

Closed
ramondeklein opened this issue Jun 28, 2024 · 4 comments · Fixed by #807 or #828
Closed

Version 13.0.10 doesn't respect onInsertPathParam hook #806

ramondeklein opened this issue Jun 28, 2024 · 4 comments · Fixed by #807 or #828
Labels
bug Something isn't working

Comments

@ramondeklein
Copy link

ramondeklein commented Jun 28, 2024

I'm using the following custom configuration:

module.exports = {
  hooks: {
    onInsertPathParam: (paramName) => `encodeURIComponent(${paramName})`,
  },
};

This encodes all parameters using encodeURIComponent in the URL path. This works great with v13.0.9, but it doesn't work with v13.0.10 anymore.

This is generated with v13.0.9:

    deleteBucket: (name: string, params: RequestParams = {}) =>
      this.request<void, ApiError>({
        path: `/buckets/${encodeURIComponent(name)}`,
        method: "DELETE",
        secure: true,
        ...params,
      }),

This is generated with v13.0.10:

    deleteBucket: (name: string, params: RequestParams = {}) =>
      this.request<void, ApiError>({
        path: `/buckets/${name}`,
        method: "DELETE",
        secure: true,
        ...params,
      }),
@shrpne
Copy link
Contributor

shrpne commented Jun 29, 2024

Loading of custom config is broken in 13.0.10, downgrading to 13.0.9 should help

@smorimoto
Probably replacing require() with import() should fix it index.js#L304
Also it is a good idea to display an error instead of hiding it index.js#L306

@smorimoto
Copy link
Collaborator

I'm away from home today and can't deal with this right away, so the patch is very welcome.

@smorimoto smorimoto added the bug Something isn't working label Jun 29, 2024
@ramondeklein
Copy link
Author

ramondeklein commented Jul 1, 2024

This fix didn't solve our issue. It's still broken with 13.0.12. Could this issue be reopened?

@shrpne
Copy link
Contributor

shrpne commented Jul 15, 2024

@ramondeklein it should be fixed in next release, until in released you can do one of:

  • install latest commit from github npm i acacode/swagger-typescript-api
  • don't export default and export named instead export const hooks = {onInsertPathParam: () => {}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants