Skip to content

Commit

Permalink
chore(deps): update @hey-api/openapi-ts to 0.42.1
Browse files Browse the repository at this point in the history
- Update to the latest `@hey-api/openapi-ts` version `0.42.1`
- Fixed a bug where types in mutation hooks were imported from a (non-relative) direct file import.
    - This is the same fix implemented in #61, which was done for query hooks.
- Fixed a bug where JSDocs were not being added to generated hooks.
- Add more unit tests

Fixes: #83
Enables work towards: #81
  • Loading branch information
seriouslag committed Apr 22, 2024
1 parent 18ac5fa commit f70fd02
Show file tree
Hide file tree
Showing 22 changed files with 1,121 additions and 424 deletions.
29 changes: 11 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ Options:
-o, --output <value> Output directory (default: "openapi")
-c, --client <value> HTTP client to generate [fetch, xhr, node, axios, angular] (default: "fetch")
--request <value> Path to custom request file
--useDateType Use Date type instead of string for date types for models, this will not convert the data to a Date object
--enums <value> Generate JavaScript objects from enum definitions? ['javascript', 'typescript']
--base <value> Manually set base in OpenAPI config instead of inferring from server value
--serviceResponse <value> Define shape of returned value from service calls ['body', 'generics', 'response']
--format <value> Process output folder with formatter? ['biome', 'prettier']
--lint <value> Process output folder with linter? ['eslint', 'biome']
--operationId Use operation ID to generate operation names?
--lint Process output folder with linter?
--format Process output folder with formatter?
--serviceResponse <value> Define shape of returned value from service calls ['body', 'generics', 'response']
--base <value> Manually set base in OpenAPI config instead of inferring from server value
--enums <value> Generate JavaScript objects from enum definitions? ['javascript', 'typescript']
--useDateType Use Date type instead of string for date types for models, this will not convert the data to a Date object
--debug Enable debug mode
--noSchemas Disable generating schemas for request and response objects
--schemaTypes <value> Define the type of schema generation ['form', 'json'] (default: "json")
-h, --help display help for command
```

Expand Down Expand Up @@ -86,11 +89,7 @@ function App() {
return (
<div className="App">
<h1>Pet List</h1>
<ul>
{data?.map((pet) => (
<li key={pet.id}>{pet.name}</li>
))}
</ul>
<ul>{data?.map((pet) => <li key={pet.id}>{pet.name}</li>)}</ul>
</div>
);
}
Expand Down Expand Up @@ -129,13 +128,7 @@ import { useDefaultClientFindPetsSuspense } from "../openapi/queries/suspense";
function ChildComponent() {
const { data } = useDefaultClientFindPetsSuspense({ tags: [], limit: 10 });

return (
<ul>
{data?.map((pet, index) => (
<li key={pet.id}>{pet.name}</li>
))}
</ul>
);
return <ul>{data?.map((pet, index) => <li key={pet.id}>{pet.name}</li>)}</ul>;
}

function ParentComponent() {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dev:mock": "prism mock ./petstore.yaml --dynamic",
"build": "tsc && vite build",
"preview": "vite preview",
"generate:api": "node ../../dist/cli.mjs -i ./petstore.yaml -c axios --request ./request.ts",
"generate:api": "rimraf ./openapi && node ../../dist/cli.mjs -i ./petstore.yaml -c axios --request ./request.ts",
"test:generated": "tsc -p ./tsconfig.openapi.json --noEmit"
},
"dependencies": {
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"author": "Daiki Urata (@7nohe)",
"license": "MIT",
"devDependencies": {
"@hey-api/openapi-ts": "0.36.0",
"@hey-api/openapi-ts": "0.42.1",
"@types/node": "^20.10.6",
"@vitest/coverage-v8": "^1.5.0",
"commander": "^12.0.0",
Expand All @@ -49,11 +49,11 @@
"vitest": "^1.5.0"
},
"peerDependencies": {
"@hey-api/openapi-ts": "0.36.0",
"commander": ">= 11 < 13",
"glob": ">= 10",
"ts-morph": ">= 22 < 23",
"typescript": ">= 4.8.3"
"@hey-api/openapi-ts": "0.42.1",
"commander": "12.x",
"glob": "10.x",
"ts-morph": "22.x",
"typescript": "5.x"
},
"engines": {
"node": ">=14"
Expand Down
Loading

0 comments on commit f70fd02

Please sign in to comment.