Skip to content

Conversation

@Akuukis
Copy link
Contributor

@Akuukis Akuukis commented Aug 10, 2025

💭 Notes

Generate react-query helpers from API with Orval. By it's own does nothing. See these few refactors, the rest is for now unused generated files:

  • jsapp/js/api.ts
  • package.json
  • package-lock.json

Configuration is split across these files:

  • orval.config.js
  • jsapp/js/api/orval.mutator.ts
  • jsapp/js/api/orval.operationName.ts
  • scripts/generate_api.sh
  • .github/workflows/openapi.yml

See other refactor PRs that use these helpers to call API:

👀 Preview steps

  1. run kobo-install locally
  2. ./run.py -cf run --rm kpi ./scripts/generate_api.sh to re-generate helpers
  3. notice that helpers are regenerated
  4. click around so that some APIs are called the old way
  5. notice that it still works and the refactors didn't break anything

@Akuukis Akuukis self-assigned this Aug 10, 2025
@Akuukis Akuukis force-pushed the kalvis/api-orval branch 2 times, most recently from 4a6835d to 4807342 Compare August 10, 2025 20:46
@Akuukis
Copy link
Contributor Author

Akuukis commented Aug 11, 2025

root cause for CI fail is addressed at #6084, let's merge that into main, then main into feature/api-documentation and then rebase this PR.

@Akuukis Akuukis force-pushed the kalvis/api-orval branch 2 times, most recently from ac0ff84 to fb91f82 Compare August 11, 2025 16:19
@Akuukis Akuukis requested a review from jnm as a code owner August 11, 2025 16:19
@Akuukis Akuukis changed the base branch from feature/api-documentation to kalvis/ignore-minified-swagger August 11, 2025 16:27
Base automatically changed from kalvis/ignore-minified-swagger to feature/api-documentation August 13, 2025 12:59
@Akuukis Akuukis force-pushed the kalvis/api-orval branch 2 times, most recently from 708a733 to 563a626 Compare August 13, 2025 16:39
@Akuukis Akuukis force-pushed the kalvis/api-orval branch 3 times, most recently from 006359a to 3a900e6 Compare August 19, 2025 09:50
@Akuukis Akuukis changed the title feat(frontend): Orval generated react-query helpers from API DEV-584 refactor(frontend): Orval generated react-query helpers from API DEV-584 Aug 19, 2025
@Akuukis Akuukis changed the title refactor(frontend): Orval generated react-query helpers from API DEV-584 refactor(frontend): Orval generated react-query helpers from API DEV-584 DEV-893 Aug 19, 2025
Akuukis added a commit that referenced this pull request Aug 20, 2025
### 💭 Notes

For development purposes let's commit the generated schema, so that we
can build on top of that frontend typed API helpers, see #6083.

To ensure that the committed schema is always up-to-date, let's add to
CI a job that checks if it's generated.

P.S. along the way simplified the script with a helper for gosu.

### 👀 Preview steps

1. see the new "openapi" job
2. 🟢 [on PR showcase commit
[f4d9501](f4d9501)
before updating schema] notice that CI fails
3. 🟢 [on PR latest commit
[936c461](936c461)
after updating schema] notice that CI succeeds
4. 🟢 run locally `./run.py -cf run --rm kpi
./scripts/generate_openapi_schemas.sh` from `kobo-install` and it
succeeds to regenerate schema
Base automatically changed from feature/api-documentation to main August 22, 2025 18:14
@Akuukis Akuukis changed the title refactor(frontend): Orval generated react-query helpers from API DEV-584 DEV-893 refactor(frontend): generate API react-query helpers with Orval DEV-584 DEV-893 Aug 25, 2025
@Akuukis Akuukis force-pushed the kalvis/api-orval branch 5 times, most recently from 60b1e32 to e6aee5a Compare August 25, 2025 14:50
@Akuukis Akuukis requested review from pauloamorimbr and removed request for olive-KTB, p2edwards and rgraber August 27, 2025 06:57
@Akuukis Akuukis changed the title refactor(frontend): generate API react-query helpers with Orval DEV-584 DEV-893 refactor(frontend): generate API react-query helpers with Orval DEV-893 Aug 27, 2025
Copy link
Contributor

@pauloamorimbr pauloamorimbr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💯
Tested, generated and checked code.
Nothing breaks!
Nice job!

@Akuukis Akuukis merged commit aa3b6a4 into main Aug 28, 2025
12 checks passed
@Akuukis Akuukis deleted the kalvis/api-orval branch August 28, 2025 10:46
pauloamorimbr pushed a commit that referenced this pull request Sep 8, 2025
…93 (#6083)

### 💭 Notes

Generate react-query helpers from API with Orval. By it's own does
nothing. See these few refactors, the rest is for now unused generated
files:
- `jsapp/js/api.ts`
- `package.json`
- `package-lock.json`

Configuration is split across these files:
- `orval.config.js`
- `jsapp/js/api/orval.mutator.ts`
- `jsapp/js/api/orval.operationName.ts`
- `scripts/generate_api.sh`
- `.github/workflows/openapi.yml`

See other refactor PRs that use these helpers to call API:
- #6090

### 👀 Preview steps

1. run kobo-install locally
2. `./run.py -cf run --rm kpi ./scripts/generate_api.sh` to re-generate
helpers
3. notice that helpers are regenerated
4. click around so that some APIs are called the old way
5. notice that it still works and the refactors didn't break anything
pauloamorimbr pushed a commit that referenced this pull request Sep 17, 2025
…93 (#6083)

### 💭 Notes

Generate react-query helpers from API with Orval. By it's own does
nothing. See these few refactors, the rest is for now unused generated
files:
- `jsapp/js/api.ts`
- `package.json`
- `package-lock.json`

Configuration is split across these files:
- `orval.config.js`
- `jsapp/js/api/orval.mutator.ts`
- `jsapp/js/api/orval.operationName.ts`
- `scripts/generate_api.sh`
- `.github/workflows/openapi.yml`

See other refactor PRs that use these helpers to call API:
- #6090

### 👀 Preview steps

1. run kobo-install locally
2. `./run.py -cf run --rm kpi ./scripts/generate_api.sh` to re-generate
helpers
3. notice that helpers are regenerated
4. click around so that some APIs are called the old way
5. notice that it still works and the refactors didn't break anything
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants