Giter Club home page Giter Club logo

Comments (4)

john-nhoj avatar john-nhoj commented on July 28, 2024

@pbrzosko , have you found a workaround?
I find myself in a similar situation and found out it is because the variable is not wrapped with unref

from orval.

pbrzosko avatar pbrzosko commented on July 28, 2024

Yeah, for now I have overwritten the formBody, If I remember correctly, to be empty just for this one endpoint I have with an error. I don't use this endpoint for now so I could do it like that.

from orval.

john-nhoj avatar john-nhoj commented on July 28, 2024

Ok, I found a workaround.

If you use a custom instance of Axios, the generated client uses unref correctly.

You can copy this file from samples/vue-query: https://github.com/anymaniax/orval/blob/833faeb9cc656a2ec87816479a4ebf9321edfc89/samples/vue-query/src/api/mutator/custom-instance.ts

And if you re-run the generation, for me, it fixed those variables accessed before unref is called.
Hope it helps!

from orval.

pbrzosko avatar pbrzosko commented on July 28, 2024

Another example:

const queryFn: QueryFunction<Awaited<ReturnType<typeof sampleEntityGetMetadata>>> = ({ signal }) => sampleEntityGetMetadata(unref(id,params), { signal, ...fetchOptions });

There are two errors here:

  • unref with two parameters where it expects one
  • and then that status is required in params

Seems like it should simply be:

const queryFn: QueryFunction<Awaited<ReturnType<typeof sampleEntityGetMetadata>>> = ({ signal }) => sampleEntityGetMetadata(unref(id), unref(params), { signal, ...fetchOptions });

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.