openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

feat(openapi-fetch): enable middleware request param module augmentation

Open Katli95 opened this issue 2 months ago • 2 comments

Changes

Decided to open PR in lieu of issue.

I just changed the .d.ts file manually and extracted the MiddlewareRequestParams into their own interface. It opens up the possibility for using TS module augmentation to add parameters to the params property and use those in the middleware.

My use-case is changing authentication logic based on a variable that isn't passed through to the API being invoked.

How to Review

Look at the file, I guess? 🤗

Also, I would be open to going deeper in a follow-up PR to look into how the client facing types could mirror the custom parameter added, if this is indeed an avenue you're open to exploring.

Checklist

(skipped all since it's just a small TS update and I didn't pull to local)

  • [ ] Unit tests updated
  • [ ] docs/ updated (if necessary)
  • [ ] pnpm run update:examples run (only applicable for openapi-typescript)

Katli95 avatar Nov 21 '25 10:11 Katli95