Giter VIP home page Giter VIP logo

Comments (5)

Jesus-Hernandez23 avatar Jesus-Hernandez23 commented on May 27, 2024 1

@stijnvanhulle thanks this fix help me a lot but I still have struggle when performing the type checking in TypeScript because TVariables is always of type void even when it receives parameters.

I checked generated function for usePostAPIv!Accountants() and i realized that the type definition is not being passed to TVariables.
image
image

i can keep fixing this manually but obviously when execute again kubb --config ./kubb.config.ts my changes are going to be deleted or unsynced
Screenshot 2023-06-11 011319

"post": { "tags": [ "Accountants" ], "requestBody": { "content": { "application/json-patch+json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/AddAccountant" } }, "application/json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/AddAccountant" } }, "text/json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/AddAccountant" } }, "application/*+json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/AddAccountant" } } } }, "responses": { "200": { "description": "Success", "content": { "text/plain; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/StringApiResponse" } }, "application/json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/StringApiResponse" } }, "text/json; x-api-version=1.0": { "schema": { "$ref": "#/components/schemas/StringApiResponse" } } } } }

from kubb.

stijnvanhulle avatar stijnvanhulle commented on May 27, 2024

@Jesus-Hernandez23 Can you add the function for usePostAPIv!Accountants(). Need to see which types are getting used there causing the void.

from kubb.

Jesus-Hernandez23 avatar Jesus-Hernandez23 commented on May 27, 2024

@Jesus-Hernandez23 Can you add the function for usePostAPIv!Accountants(). Need to see which types are getting used there causing the void.

sure this is generated code:

import { useMutation, UseMutationOptions } from '@tanstack/react-query';
import client from '@kubb/swagger-client/client';
import type { PostApiV1AccountantsMutationResponse } from '.\\..\\models\\PostApiV1Accountants';

/**
 * @link /api/v1/Accountants
 */
export function usePostApiV1Accountants<TData = PostApiV1AccountantsMutationResponse, TError = unknown>(options?: {
  mutation?: UseMutationOptions<TData, TError>;
}) {
  const { mutation: mutationOptions } = options ?? {};

  return useMutation<TData, TError>({
    mutationFn: () => {
      return client<TData, TError>({
        method: 'post',
        url: `/api/v1/Accountants`,
      });
    },
    ...mutationOptions,
  });
}

from kubb.

stijnvanhulle avatar stijnvanhulle commented on May 27, 2024

@Jesus-Hernandez23 This Seems to be an issue related to the paths that are getting generated. Node.js always uses / but for some reason we have a bug that makes use of the platform and converts / to \ for Windows.

See '.\\..\\models\\PostApiV1Accountants';

Will be fixed with chore/e2eWindows( and also added a Github actions for Windows to be 100% sure.

from kubb.

stijnvanhulle avatar stijnvanhulle commented on May 27, 2024

Aha found the issue, we had hardcoded to always use application/json as requestBodyType but here you are using application/json; x-api-version=1.0 which was not getting found by our generator.

I will open a PR so it's not hardcoded anymore :)

from kubb.

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.