Skip to content

Update type generation command to use heyapi#7920

Merged
lucanovera merged 1 commit intomainfrom
update-type-generation-command
Apr 14, 2026
Merged

Update type generation command to use heyapi#7920
lucanovera merged 1 commit intomainfrom
update-type-generation-command

Conversation

@lucanovera
Copy link
Copy Markdown
Contributor

@lucanovera lucanovera commented Apr 14, 2026

Ticket ENG-1859

Description Of Changes

Update openapi:generate command in admin-ui to use the new heyapi generation library. The command update was mistakenly reverted on the original PR #7757

Code Changes

  • Update openapi:generate command

Steps to Confirm

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Add a db-migration This indicates that a change includes a database migration label to the entry if your change includes a DB migration
    • Add a high-risk This issue suggests changes that have a high-probability of breaking existing code label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!
    • No migrations
  • Documentation:
    • Documentation complete, PR opened in fidesdocs
    • Documentation issue created in fidesdocs
    • If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
    • No documentation updates required

@lucanovera lucanovera marked this pull request as ready for review April 14, 2026 20:21
@lucanovera lucanovera requested a review from a team as a code owner April 14, 2026 20:21
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 14, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Apr 14, 2026 8:28pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Apr 14, 2026 8:28pm

Request Review

@lucanovera lucanovera requested review from gilluminate and removed request for a team April 14, 2026 20:21
@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities found.

Scanned Files

None

@github-actions
Copy link
Copy Markdown

Title Lines Statements Branches Functions
admin-ui Coverage: 8%
6.09% (2663/43665) 5.22% (1293/24754) 4.19% (542/12923)
fides-js Coverage: 78%
78.98% (1962/2484) 65.55% (1214/1852) 72.57% (336/463)
privacy-center Coverage: 88%
85.93% (330/384) 81.1% (176/217) 78.87% (56/71)

Copy link
Copy Markdown
Contributor

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR migrates the openapi:generate and openapi:generate-dictionary npm scripts from the old openapi CLI (inline flags) to the new openapi-ts CLI (@hey-api/openapi-ts) backed by dedicated config files. The change is clean and the config files contain meaningful customization (schema patches, enum varname remapping, per-symbol file splitting). A couple of things worth a look:

Config API inconsistency (notable)

openapi-ts-dictionary.config.ts uses a types top-level key for enum and casing settings, while openapi-ts-api.config.ts uses the plugins array with @hey-api/typescript. At ^0.88.2 the plugins-based API is the current one; the types key appears to be from an earlier version and may be silently ignored, meaning the enum/casing settings in the dictionary config might not actually apply. This is flagged inline on line 30.

Prettier scope change

The old openapi:generate command ran prettier --write . (the whole project) after generation. The new approach scopes formatting to the output path via format: "prettier" in the config. This is almost certainly better, but worth verifying that no other files were relying on that trailing prettier --write . to stay formatted during the codegen workflow.

Minor observations in openapi-ts-api.config.ts

  • The file has /* eslint-disable no-param-reassign */ at the top, making the // eslint-disable-next-line no-param-reassign inline comments on lines 20 and 29 redundant.
  • Several patch.schemas handlers use (schema: any) — this is a pragmatic workaround but worth noting in case the library exposes better types for these patch callbacks in the future.
  • getFilePath returns undefined to skip endpoint-specific types and route each named symbol to models/<Name>. This is a meaningful structural change from the old flat output; confirming that all existing imports from ./src/types/api still resolve correctly after regeneration would be a good sanity check.

Overall

The migration looks reasonable. The main actionable item is verifying or fixing the dictionary config's API version to use plugins for consistency with the main config.


🔬 Codegraph: unavailable

💡 Write /code-review in a comment to re-run this review.

"lint-staged:fix": "lint-staged --diff=main",
"openapi:generate": "openapi --input http://localhost:8080/openapi.json --output ./src/types/api --exportCore false --exportServices false --indent 2 && prettier --write .",
"openapi:generate-dictionary": "openapi --input http://localhost:8081/openapi.json --output ./src/types/dictionary-api --exportCore false --exportServices false --indent 2",
"openapi:generate": "openapi-ts --file openapi-ts-api.config.ts",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clients/admin-ui/package.json:29

The old command ran prettier --write . after code generation. The new config handles formatting via format: "prettier" in openapi-ts-api.config.ts, so that's covered for the API types. Just worth confirming the prettier formatting output is equivalent — particularly that the same files are reformatted (the old command targeted ., the new one targets only the generated output path).

"openapi:generate": "openapi --input http://localhost:8080/openapi.json --output ./src/types/api --exportCore false --exportServices false --indent 2 && prettier --write .",
"openapi:generate-dictionary": "openapi --input http://localhost:8081/openapi.json --output ./src/types/dictionary-api --exportCore false --exportServices false --indent 2",
"openapi:generate": "openapi-ts --file openapi-ts-api.config.ts",
"openapi:generate-dictionary": "openapi-ts --file openapi-ts-dictionary.config.ts",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clients/admin-ui/package.json:30

openapi-ts-dictionary.config.ts uses a types top-level key (types.enums, types.identifierCase) while openapi-ts-api.config.ts uses the plugins array (@hey-api/typescript with enums and case). These look like different API versions of @hey-api/openapi-ts. With the installed version ^0.88.2, the types key may be silently ignored or produce a deprecation warning. Consider aligning the dictionary config to use the same plugins-based API as the main config to ensure the enum generation settings actually take effect.

@lucanovera lucanovera added this pull request to the merge queue Apr 14, 2026
Merged via the queue into main with commit ac336a7 Apr 14, 2026
53 of 54 checks passed
@lucanovera lucanovera deleted the update-type-generation-command branch April 14, 2026 20:40
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