Skip to content

Commit b0f2f6d

Browse files
committed
patch(return types): union return type with undefined.
React query data is undefined by default. Previously we were overriding the default type of react query. Now union with undefined. We are also exporting the data type.
1 parent febb22c commit b0f2f6d

File tree

3 files changed

+235
-195
lines changed

3 files changed

+235
-195
lines changed

examples/react-app/petstore.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ paths:
7777
application/json:
7878
schema:
7979
$ref: '#/components/schemas/Error'
80+
/not-defined:
81+
get:
82+
description: This path is not fully defined.
83+
responses:
84+
default:
85+
description: unexpected error
8086
/pets/{id}:
8187
get:
8288
description: Returns a user based on a single ID, if the user does not have access to the pet

examples/react-app/src/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
useDefaultClientAddPet,
44
useDefaultClientFindPets,
55
useDefaultClientFindPetsKey,
6+
useDefaultClientGetNotDefined,
67
} from "../openapi/queries";
78
import { useState } from "react";
89
import { queryClient } from "./queryClient";
@@ -13,6 +14,10 @@ function App() {
1314

1415
const { data, error, refetch } = useDefaultClientFindPets({ tags, limit });
1516

17+
// This is an example of a query that is not defined in the OpenAPI spec
18+
// this defaults to any - here we are showing how to override the type
19+
const { data: notDefined } = useDefaultClientGetNotDefined<undefined>();
20+
1621
const { mutate: addPet } = useDefaultClientAddPet();
1722

1823
if (error)

0 commit comments

Comments
 (0)