Comments (3)
@OliverDudgeon Hello, thanks for reporting this bug. I just published a new alpha version that should solve your problem you can check 5.0.0-alpha.5. I saw that you use multipart with an object, I did an implementation for it but if it's doesn't work for your case let me know what you would have expected. But either way, you can use a mutator with those operations to send the data as you want.
from orval.
Hi, thanks for the alpha build. It's letting us make progress!
The multipart forms use arrays for "labels". Our API accepts these comma-seperated so
["label1", "label2"] => "label1,label2"
E.g. our Swagger UI generates this curl
curl -X POST "https://squonk.informaticsmatters.org/data-manager-api/dataset" -H "accept: application/json" -H "Authorization: Bearer eyJV0y_QX...3a_Ag7nMtA" -H "Content-Type: multipart/form-data" -F "as_filename=test" -F "dataset_type=chemical/x-mdl-sdfile" -F "labels=l1,l2" -F "[email protected];type=application/gzip"
I.e just a labels.join(',')
but this of course just our chosen method. Like with query parameters there are several ways for Objects and Array.
I would guess Orval should provide a field in the config that would take an object or array and "stringify" it based on the user's API design via something like qs maybe? Or is that just a missing example/doc for how to use a mutator?
from orval.
Hello, Thanks for the feedback. When you use a mutator you receive directly the body data not transformed and then you can use it or transform it how you want. I am hesitating to add an option in the config to modify directly the form data. You would give the default key for the form data (currently like this formData.append('data', THEDATA) or a function to help you generate your form data how you want (example (bodyData) => { your implementation which return a form data })
from orval.
Related Issues (20)
- Support for Svelte Query v5 HOT 1
- Node16 or bundler module resolution causes TS2742 error HOT 1
- Missing import of enum const in generated mock when using split mode HOT 5
- Mock TypeError custom override HOT 7
- Possibility of TS2563 error for mock generation HOT 5
- TS2300 Duplicate identifier: duplicated imports when `mock` enabled HOT 7
- Allow overriding entire handler function in generated MSW handlers, not just response object
- Invalid typescript generation for empty schema HOT 4
- msw generation does not import used models HOT 1
- Mock generation doesn't guarantee the required property mocking
- Is possible ignore the changes in the line of OpenAPI spec version ? HOT 2
- Another duplicate export edge case
- Specify mock property overrides for a specific schema HOT 2
- Support replacing types with custom ones when transforming the input HOT 5
- React Query: Regression in 6.25.0 caused by #1207 HOT 5
- Is possible ignore the changes in the line of OpenAPI spec version ?
- Orval generates wrong import paths in ESM-only package HOT 3
- Pass an additional option object in fetcher function when using custom axios instance HOT 4
- usePrefetch+useSuspenseQuery incorrectly generates prefetchSuspenseQuery calls
- bug: readonly fields missing from mutation function input types
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 orval.