Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue: variable for path parameter was converted wrong #1257

Open
wiz-tajima opened this issue Mar 8, 2024 · 0 comments
Open

Vue: variable for path parameter was converted wrong #1257

wiz-tajima opened this issue Mar 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wiz-tajima
Copy link

wiz-tajima commented Mar 8, 2024

What are the steps to reproduce this issue?

  1. …generate on Vue3 project.

What happens?

Orval generates code below:

export const useGetReportHook = () => {
     const getReport = useCustomInstance<ReportGetResponse>();

    return (
      id: MaybeRef<string>,
      signal?: AbortSignal
    ) => {
        return getShippingOrderReportSetting({
        url: `/reports/${encodeURIComponent(String(id))}`, method: 'GET', signal
    },);
   }
 }

This code has critical problem: variable "id" will be converted for an string "[Object Object]" with String().
"id" must be converted with unref().

What were you expecting to happen?

Expected generate:

export const useGetReportHook = () => {
   const getReport = useCustomInstance<ReportGetResponse>();

   return (
    id: MaybeRef<string>,
    signal?: AbortSignal
    ) => {
          return getShippingOrderReportSetting({
          url: `/reports/${encodeURIComponent(unref(id))}`, method: 'GET', signal
          },);
     }
  }

Any logs, error output, etc?

Any other comments?

For now, I fixed project's code to pass unrefed path parameter (not to pass it as it is Ref Object).
This fixing will break reactivity, so I'm worried to cause new bugs...😣

What versions are you using?

Operating System: … Linux (WSL)
Package Version: …6.25.0
Browser Version: N/A

@melloware melloware added the bug Something isn't working label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants