Code Monkey home page Code Monkey logo

Comments (3)

anymaniax avatar anymaniax commented on May 14, 2024

@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.

OliverDudgeon avatar OliverDudgeon commented on May 14, 2024

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.

anymaniax avatar anymaniax commented on May 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.