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

feat: update Orval config #8038

Merged
merged 1 commit into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions frontend/orval.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
* How to generate OpenAPI client
*
* For now we only use generated types (src/openapi/models).
* We will use methods (src/openapi/apis) for new features soon.
* 1. `yarn gen:api` to generate the client
* 2. `rm -rf src/openapi/apis` to remove methods (! except if you want to use some of those)
* 3. clean up `src/openapi/index.ts` imports
* Run `yarn gen:api` to generate the client.
* We may use methods (src/openapi/apis) for new features in the future.
*/
module.exports = {
unleashApi: {
Expand Down Expand Up @@ -34,5 +32,8 @@ module.exports = {
process.env.UNLEASH_OPENAPI_URL ||
'http://localhost:4242/docs/openapi.json',
},
hooks: {
afterAllFilesWrite: './scripts/clean_orval_generated.sh',
},
},
};
5 changes: 2 additions & 3 deletions frontend/scripts/clean_orval_generated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ rm -rf src/openapi/apis

# Remove all but last line from index.ts
echo "Cleaning index.ts..."
tail -1 src/openapi/index.ts > index_tmp ;
cat index_tmp > src/openapi/index.ts ;
rm index_tmp
echo "export * from './models';" > src/openapi/index.ts
echo '' >> src/openapi/index.ts

echo "Formatting..."
yarn fmt
Expand Down
Loading