Skip to content

Commit

Permalink
Merge pull request #2 from zerodays/feat-zodios-from-openapi
Browse files Browse the repository at this point in the history
Auto generate zodios client from openapi spec
  • Loading branch information
vucinatim authored May 29, 2024
2 parents eefd415 + e15bb42 commit 40ec3fb
Show file tree
Hide file tree
Showing 9 changed files with 5,077 additions and 5,978 deletions.
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,7 @@ next-env.d.ts

# Ignore autogenerated files
.infisical.json
components.json
components.json

# Handlebars templates
zodios-client-template.hbs
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Getting started with this Next.js template is straightforward. Follow these step
- [zod](https://zod.dev/) for form validation
- [Zodios](https://www.zodios.org/docs/client) for external API calls with validation
- Github Actions for lint, typecheck, localizations checks and tests.
- [openapi-zod-client](https://www.npmjs.com/package/openapi-zod-client) for generating API clients
- We include a handlebars template for generating the zodios client from the openapi spec. It can be used with `pnpm gen-api` command.
- [Utility hooks](https://usehooks.com/) for common tasks
- Custom `useScrollCallback` for efficient scroll event handling

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"format:fix": "prettier --write --ignore-path .prettierignore .",
"test": "jest",
"test:watch": "jest --watch",
"i18n": "tsx ./scripts/validate-translations.ts"
"i18n": "tsx ./scripts/validate-translations.ts",
"gen-api": "infisical run --command 'openapi-zod-client \"$NEXT_PUBLIC_API_URL/docs/bundle.yml\" -o './src/zodios/inedx.ts' -t ./scripts/zodios-client-template.hbs' && prettier --write ./src/zodios/inedx.ts"
},
"dependencies": {
"@hookform/resolvers": "^3.3.4",
Expand Down Expand Up @@ -68,10 +69,11 @@
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-sonarjs": "^1.0.3",
"husky": "^8.0.0",
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^15.2.2",
"openapi-zod-client": "^1.18.1",
"postcss": "^8",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
Expand Down
Loading

0 comments on commit 40ec3fb

Please sign in to comment.