Skip to content

How to filter outgoing request body #1042

Answered by CodeSmith32
CodeSmith32 asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, I think I figured this out!

The power of swagger-typescript-api primarily exists in its ability to allow us to override templates. It took a lot of reconfiguration and work, but I think it's working very well now.

I started by switching from a command-line build process to a script. I now have a command that looks like, tsx ./api/generateApi.ts which then imports generateApi from swagger-typescript-api and calls it.

Then I used the generateApi templates parameter to provision a custom template for the HttpClient class (http-client.ejs) by copy/pasting the template from the swagger-typescript-api package's templates/base/http-clients/fetch-http-client.ejs file. In the copied template, …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CodeSmith32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant