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

Response types from openapi-fetch ignore null values #1637

Open
1 task done
gbbarroso opened this issue Apr 28, 2024 · 0 comments
Open
1 task done

Response types from openapi-fetch ignore null values #1637

gbbarroso opened this issue Apr 28, 2024 · 0 comments
Labels
bug Something isn't working good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!

Comments

@gbbarroso
Copy link

gbbarroso commented Apr 28, 2024

Description

Basically - types are getting a NonNullable<> somewhere and I believe they shouldn't

Reproduction
This was tested on version 0.9.3

type TestPaths = {
  '/v1/test': {
    /** @description Start a process flow */
    post: {
      /** @description Body */
      requestBody: {
        content: {
          'application/json': { test: boolean };
        };
      };
      responses: {
        /** @description Response */
        200: {
          content: {
            'application/json': { test: string | null };
          };
        };
      };
    };
  };
};

async function testFunction() {
  const client = createClient<TestPaths>({ baseUrl: '' });
  const result = await client
    .POST('/v1/test', { body: { test: true } })
    .then((x) => x.data);
  type Result = typeof result;
}

Expected result

Result should be { test: string | null }, not { test: string }

Checklist

@gbbarroso gbbarroso added bug Something isn't working openapi-fetch Relevant to the openapi-fetch library labels Apr 28, 2024
@drwpow drwpow added PRs welcome PRs are welcome to solve this issue! good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project labels Jun 24, 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 good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!
Projects
None yet
Development

No branches or pull requests

2 participants