Skip to content

Orval generated mutation way to add more input vars then from open-api spec required... #1539

@maapteh

Description

@maapteh

What are the steps to reproduce this issue?

  1. Generate the Overal React Query Mutation hook

What happens?

It correctly generated the mutation hook:

export const usePostCompartmentidOpen = <
  TError = ErrorType<NotFoundResponse | InternalServerErrorResponse | BadGatewayResponse>,
  TContext = unknown,
>(options?: {
  mutation?: UseMutationOptions<
    Awaited<ReturnType<typeof postCompartmentidOpen>>,
    TError,
    { compartmentId: string },
    TContext
  >

What were you expecting to happen?

I can not find a way to pass more input variables on the mutation itself when we auto generate. I looked in the documentation, also nothing in the Orval configuration.

What we currently have, in the non auto generated app, is the following:

mutationOpen.mutate({ compartmentId, statistics })

where statistics is typed like statistics?: Statistics

Then in the result we have:
onSuccess(_, { compartmentId, statistics }) {

The reason is that we pass more context to the mutation which we use for analytics and loggings. Since we take these from the success/error handler. Does the Orval generation foresee something like this?

Any logs, error output, etc?

All works as expected, but i simply can not find a way

Any other comments?

None

What versions are you using?

Latest RQ and latest Orval. Its not a bug but im trying to understand if its intended to create the shared hook like this

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions