Comments (7)
Hi @mrlubos sorry missed your comment!
Yes I added the transformers by hand after generating the client. So, some of my endpoints return a csv file, but I want to parse it and return a json from that csv, so I added a transformer in those functions. Also, the end user (one consuming the client) has the ability to pass transformers, so from that perspective as well feels a bit weird that an async transformer breaks the client.
Many thanks for the quick action, I will try it out and let you know!
from openapi-ts.
And to answer your last question, this is a new project that I am working on, so there was nothing prior to this unfortunately. I was just trying to figure what would be the easiest solution and thought transformers made the most sense. Interceptors could also work I suppose.
Right now as a workaround (let me preface by saying which is not very good), I return the body as a promise and await for it after getting the data. I just needed it to work somehow, but will change it soon to use the async transformers.
from openapi-ts.
Can you provide a small StackBlitz example?
from openapi-ts.
I forked the demo stackblitz, and added an async transformer in the addPet
method (src/client/services.gen.ts:62
). If you now try to add a pet, it breaks the app. Let me know if this works, else I'd be happy to provide a smaller StackBlitz example.
from openapi-ts.
@anurag-roy Where do these transformers come from? Are you writing them by hand? What were you doing prior to this being a supported feature?
The requirement is clear, asking for extra context around it for my understanding.
from openapi-ts.
@anurag-roy this will be available in the next release. Please let me know if it works for you + check my questions above
from openapi-ts.
That makes sense, thanks! Let me know if there are any issues with the transformers
from openapi-ts.
Related Issues (20)
- `client-fetch` now required a `ThrowOnError` generic which breaks manually created services with `fetch-client` HOT 6
- ThrowOnError can not be set to true HOT 8
- client type error in services.gen.ts HOT 3
- Mismatched case in parameter name vs generated type HOT 2
- Define required headers in one place for all service methods HOT 1
- How to only generate types without clients or the other stuff? HOT 3
- Add provenance statement
- Throw error on non-success response status
- Unexpected error occurred. Debug Failure. Unhandled SyntaxKind: Unknown HOT 6
- Prettier & Eslint: Ability to specify the path of configuration files HOT 2
- Partial options function for tanstack-query HOT 7
- Full SDK generator HOT 1
- Improve query keys
- Enable autogen import/export files with file extension
- additionalProperties number type produces output interface with integer data type HOT 1
- Generate multiple clients HOT 1
- Duplicated code when using bundle HOT 2
- Endpoints with the same operationId generate single data type HOT 5
- Generation ignore a query parameter HOT 4
- The generated types from nested allOf and oneOf's don't compose correctly HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openapi-ts.