Skip to content

Conversation

dzienisz
Copy link
Contributor

@dzienisz dzienisz commented Oct 3, 2025

Upgrade openapi-typescript to v5.4.2 to reduce npm run schema execution time by 66% and provide more accurate TypeScript types for API calls, improving autocomplete and catching API contract mismatches earlier.

Key benefits for developers:
Faster iteration: Schema regeneration goes from ~400ms → ~135ms
Better IntelliSense: More accurate types for oneOf/anyOf means better autocomplete

Summary by CodeRabbit

  • New Features

    • Added admin endpoints to view batch job queue and project batch locks.
    • Billing: richer plan/subscription details and options for billing period and subscription types.
    • Translation: added formality option (formal/informal/default).
  • Documentation

    • Clarified organization user removal behavior (removes or disables managed accounts).
  • Chores

    • Migrated schema generation to ESM, refreshed generated API schemas, and updated tooling.

Copy link
Contributor

coderabbitai bot commented Oct 3, 2025

Walkthrough

Updated package scripts and devDependency; migrated the schema generator to ESM; regenerated OpenAPI TypeScript schemas — added two admin endpoints, new JobInfo/queue/lock models, many string-enum annotations, and switched several examples to array format.

Changes

Cohort / File(s) Summary
Package + devDeps
webapp/package.json
Switched npm scripts to run generate-schemas.mjs (from .cjs) and bumped openapi-typescript from ^4.0.2 to ^5.4.2.
Generator script (CJS → ESM)
webapp/scripts/generate-schemas.mjs
Migrated generator to ES modules: replaced require with import, defined __filename/__dirname via node:url/node:path, adjusted dotenv-flow path resolution, and use node:child_process exec.
Regenerated API schema (public APIs)
webapp/src/service/apiSchema.generated.ts
Regenerated OpenAPI types: added GET /v2/administration/batch-job-queue and GET /v2/administration/project-batch-locks; introduced JobInfo, QueueItemModel, ProjectLockModel and collection wrappers; added many @enum {string} annotations and converted several inline examples to array examples.
Regenerated billing schema (public APIs)
webapp/src/service/billingApiSchema.generated.ts
Regenerated billing types: added/annotated many enum-typed fields (e.g., metricType, plan type, currentBillingPeriod, subscription status, request period, CreateTaskRequest.type, ErrorResponseTyped.code, translation formality).

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant Dev as Developer (npm)
    participant Node as Node.js (ESM)
    participant Script as generate-schemas.mjs
    participant Dotenv as dotenv-flow
    participant OpenAPI as openapi-typescript
    participant FS as FileSystem

    Dev->>Node: npm run schema (runs .mjs)
    Node->>Script: load ES module
    Script->>Dotenv: config(resolve(__dirname,'../'))  %%[#88c0d0]%%
    Script->>OpenAPI: spawn generator (exec)
    OpenAPI-->>Script: return generated TypeScript
    Script->>FS: write `webapp/src/service/*.generated.ts`
    note right of FS: New admin endpoints, JobInfo/queue/lock models, many enum annotations, example format changes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • JanCizmar

Poem

I twitch my whiskers at enums neat,
Scripts swap shoes and run on new feet.
Two admin doors open, queues align,
Arrays replace commas — tidy design.
A rabbit hops off — schemas updated, fine! 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly and succinctly summarizes the main change by indicating the feature update of the openapi-typescript dependency and its version bump, aligning directly with the pull request’s objectives to upgrade openapi-typescript from v4.0.2 to v5.4.2.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/update-openapi-typescript-to-v5

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 505613d and 989eddc.

📒 Files selected for processing (4)
  • webapp/package.json (2 hunks)
  • webapp/scripts/generate-schemas.mjs (1 hunks)
  • webapp/src/service/apiSchema.generated.ts (89 hunks)
  • webapp/src/service/billingApiSchema.generated.ts (22 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • webapp/scripts/generate-schemas.mjs
🧰 Additional context used
🧬 Code graph analysis (2)
webapp/src/service/billingApiSchema.generated.ts (1)
webapp/src/service/apiSchema.generated.ts (1)
  • components (1074-6352)
webapp/src/service/apiSchema.generated.ts (1)
webapp/src/service/billingApiSchema.generated.ts (2)
  • operations (1510-4434)
  • components (218-1508)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
  • GitHub Check: E2E testing ‍🔎 (15, 8)
  • GitHub Check: E2E testing ‍🔎 (15, 0)
  • GitHub Check: E2E testing ‍🔎 (15, 13)
  • GitHub Check: E2E testing ‍🔎 (15, 11)
  • GitHub Check: E2E testing ‍🔎 (15, 6)
  • GitHub Check: E2E testing ‍🔎 (15, 9)
  • GitHub Check: E2E testing ‍🔎 (15, 10)
  • GitHub Check: E2E testing ‍🔎 (15, 4)
  • GitHub Check: E2E testing ‍🔎 (15, 12)
  • GitHub Check: E2E testing ‍🔎 (15, 14)
  • GitHub Check: E2E testing ‍🔎 (15, 2)
  • GitHub Check: E2E testing ‍🔎 (15, 3)
  • GitHub Check: E2E testing ‍🔎 (15, 7)
  • GitHub Check: E2E testing ‍🔎 (15, 1)
  • GitHub Check: E2E testing ‍🔎 (15, 5)
  • GitHub Check: BT ‍🔎 (ee-test:test)
  • GitHub Check: BT ‍🔎 (data:test)
  • GitHub Check: BT ‍🔎 (server-app:runContextRecreatingTests)
  • GitHub Check: BT ‍🔎 (server-app:runWithoutEeTests)
  • GitHub Check: BT ‍🔎 (server-app:runWebsocketTests)
  • GitHub Check: BT ‍🔎 (server-app:runStandardTests)
🔇 Additional comments (1)
webapp/src/service/billingApiSchema.generated.ts (1)

1-4435: LGTM! Auto-generated schema changes from openapi-typescript v5.

The file has been correctly regenerated with openapi-typescript v5.4.2. Key improvements include:

  • Enhanced type annotations: String literal union types now include @enum JSDoc annotations (e.g., lines 257-258, 266-267, 273-274, etc.), which improves IntelliSense and type checking.
  • Improved documentation: Example values reformatted to multi-line array format for better readability (e.g., lines 1014-1017, 1022-1025).
  • New error codes: Added "duplicate_suggestion" and "unsupported_media_type" to ErrorResponseTyped (lines 862-863).

These changes align with the PR objectives of improved type accuracy and faster schema generation. The warning header (lines 1-4) correctly indicates this file should not be manually edited.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webapp/src/service/apiSchema.generated.ts (1)

1346-1361: Incorrect batch job type literal

The new enum literal is misspelled as "PRE_TRANSLATE_BT_TM" (missing the Y). Existing API responses and the rest of the schema still use "PRE_TRANSLATE_BY_TM", so this change breaks type safety and downstream code that references the real value. Please correct the literal before merging.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eaef88a and 439031e.

⛔ Files ignored due to path filters (1)
  • webapp/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • webapp/package.json (1 hunks)
  • webapp/src/service/apiSchema.generated.ts (80 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
webapp/src/service/apiSchema.generated.ts (1)
webapp/src/service/billingApiSchema.generated.ts (1)
  • components (218-1464)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: BT ‍🔎 (ktlint:test)
  • GitHub Check: BT ‍🔎 (data:test)
  • GitHub Check: BT ‍🔎 (server-app:runStandardTests)
  • GitHub Check: BT ‍🔎 (ee-test:test)
  • GitHub Check: BT ‍🔎 (server-app:runWebsocketTests)
  • GitHub Check: BT ‍🔎 (security:test)
  • GitHub Check: BT ‍🔎 (server-app:runWithoutEeTests)
  • GitHub Check: BT ‍🔎 (server-app:runContextRecreatingTests)
  • GitHub Check: Build frontend 🏗️
  • GitHub Check: Frontend static check 🪲

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 439031e and 8d9477f.

📒 Files selected for processing (2)
  • webapp/package.json (2 hunks)
  • webapp/scripts/generate-schemas.mjs (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
  • GitHub Check: E2E testing ‍🔎 (15, 9)
  • GitHub Check: E2E testing ‍🔎 (15, 14)
  • GitHub Check: E2E testing ‍🔎 (15, 10)
  • GitHub Check: E2E testing ‍🔎 (15, 13)
  • GitHub Check: E2E testing ‍🔎 (15, 8)
  • GitHub Check: E2E testing ‍🔎 (15, 12)
  • GitHub Check: E2E testing ‍🔎 (15, 11)
  • GitHub Check: E2E testing ‍🔎 (15, 7)
  • GitHub Check: E2E testing ‍🔎 (15, 6)
  • GitHub Check: E2E testing ‍🔎 (15, 3)
  • GitHub Check: E2E testing ‍🔎 (15, 0)
  • GitHub Check: E2E testing ‍🔎 (15, 4)
  • GitHub Check: E2E testing ‍🔎 (15, 5)
  • GitHub Check: E2E testing ‍🔎 (15, 1)
  • GitHub Check: E2E testing ‍🔎 (15, 2)
  • GitHub Check: BT ‍🔎 (ktlint:test)
  • GitHub Check: BT ‍🔎 (security:test)
  • GitHub Check: BT ‍🔎 (data:test)
  • GitHub Check: BT ‍🔎 (server-app:runWithoutEeTests)
  • GitHub Check: BT ‍🔎 (ee-test:test)
  • GitHub Check: BT ‍🔎 (server-app:runWebsocketTests)
  • GitHub Check: BT ‍🔎 (server-app:runStandardTests)
  • GitHub Check: BT ‍🔎 (server-app:runContextRecreatingTests)
  • GitHub Check: Frontend static check 🪲
🔇 Additional comments (4)
webapp/package.json (1)

72-73: LGTM! Script migration to ESM.

The update from generate-schemas.cjs to generate-schemas.mjs correctly addresses the ESM-only requirement of openapi-typescript v5. This resolves the previously flagged ERR_REQUIRE_ESM concern.

webapp/scripts/generate-schemas.mjs (3)

1-4: LGTM! Clean ESM imports.

The migration to ESM imports is correct:

  • Using node: protocol for built-in modules (recommended practice)
  • Named imports for all dependencies
  • Proper use of import statements replacing require

6-7: LGTM! Correct __filename/__dirname reconstruction.

The ESM equivalent of __filename and __dirname is properly reconstructed using fileURLToPath and dirname, which is the standard approach for ESM modules that need these Node.js CommonJS globals.


9-12: LGTM! dotenv-flow configuration updated for ESM.

The dotenv-flow configuration correctly:

  • Uses named import of config function
  • Passes path option with proper resolution to parent directory
  • Maintains the default_node_env setting

@dzienisz dzienisz force-pushed the chore/update-openapi-typescript-to-v5 branch from 8d9477f to cc11619 Compare October 14, 2025 17:05
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
webapp/scripts/generate-schemas.mjs (1)

9-12: Consider handling the config() return value.

According to dotenv-flow v4.x behavior, config() returns an error when no appropriate .env files are found. While the script will continue without throwing, missing environment variables may cause issues downstream (e.g., when VITE_APP_API_URL is needed but not set).

Apply this diff to add error handling:

-config({
+const result = config({
   default_node_env: 'development',
   path: resolve(__dirname, '../'),
 });
+
+if (result.error) {
+  console.warn('Warning: No .env files found. Using default values.');
+}

Based on learnings.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d9477f and cc11619.

⛔ Files ignored due to path filters (1)
  • webapp/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (3)
  • webapp/package.json (2 hunks)
  • webapp/scripts/generate-schemas.mjs (1 hunks)
  • webapp/src/service/apiSchema.generated.ts (88 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • webapp/package.json
🔇 Additional comments (8)
webapp/scripts/generate-schemas.mjs (1)

1-7: LGTM: ESM migration follows best practices.

The migration to ESM is correctly implemented using standard patterns:

  • fileURLToPath(import.meta.url) and dirname() for __filename/__dirname
  • Node.js built-in modules with node: prefix
  • Named imports from dotenv-flow

This migration aligns with modern JavaScript practices and likely supports openapi-typescript v5's ESM requirements.

webapp/src/service/apiSchema.generated.ts (7)

49-52: New admin endpoints added; ensure UI access control and usage are gated.

Two administration endpoints were introduced:

  • GET /v2/administration/batch-job-queue
  • GET /v2/administration/project-batch-locks

Verify these are only used in admin-only surfaces and that navigation/feature flags respect RBAC.

Also applies to: 56-59


1351-1371: Inconsistent batch job type string: BT vs BY.

Enums include PRE_TRANSLATE_BT_TM in BatchJobModel/JobInfo, while activity uses BATCH_PRE_TRANSLATE_BY_TM. Likely a "BY" vs "BT" mismatch. If UI maps by string constants, this can break badges/icons or filters.

If this is a spec typo, please adjust the OpenAPI source and re-generate. I can open a follow-up issue if needed.

Also applies to: 3058-3087, 4427-4463


2232-2535: Suspicious error code literal "tag_too_log".

ErrorResponseTyped.code includes "tag_too_log". If downstream code expects "tag_too_long", this will cause mismatches.


3559-3592: New LLM provider type "GOOGLE_AI" added.

Ensure all switch/case and mapping logic for LLM providers handles GOOGLE_AI (icons, labels, form defaults).


1262-1266: Auth provider enum adds SSO_GLOBAL.

If UI branches on authType, make sure SSO_GLOBAL is supported or gracefully handled.


5032-5038: S3 DTO includes contentStorageType?: "S3" | "AZURE".

This union inside S3ContentStorageConfigDto looks generic but can confuse forms/validators keyed by DTO name. Confirm this is intentional from the spec (shared discriminator) and that client-side validation allows both where this DTO is used.


1-20: Overall: schema regeneration looks good.

Types export shape (paths, components, operations) remains consistent with prior versions; added JSDoc enums/examples are non-breaking. LGTM on the generated file.

If you rely on operations[...] type names directly, run a quick search to confirm no breakage:

Also applies to: 21080-21083

@dzienisz dzienisz requested review from JanCizmar and dkrizan October 14, 2025 20:27
Copy link
Contributor

@JanCizmar JanCizmar left a comment

Choose a reason for hiding this comment

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

You'll have to regenerate also the billing schema

@dzienisz dzienisz force-pushed the chore/update-openapi-typescript-to-v5 branch from cc11619 to 505613d Compare October 15, 2025 10:56
@dzienisz dzienisz requested a review from JanCizmar October 15, 2025 10:56
@dzienisz dzienisz force-pushed the chore/update-openapi-typescript-to-v5 branch from 505613d to 989eddc Compare October 15, 2025 10:58
@dzienisz
Copy link
Contributor Author

dzienisz commented Oct 15, 2025 via email

@JanCizmar JanCizmar merged commit c68b109 into main Oct 15, 2025
93 of 99 checks passed
@JanCizmar JanCizmar deleted the chore/update-openapi-typescript-to-v5 branch October 15, 2025 17:12
TolgeeMachine added a commit that referenced this pull request Oct 15, 2025
# [3.135.0](v3.134.0...v3.135.0) (2025-10-15)

### Features

* update openapi-typescript from v4.0.2 to v5.4.2 ([#3264](#3264)) ([c68b109](c68b109))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants