Skip to content

Conversation

@celdrake
Copy link
Collaborator

@celdrake celdrake commented Oct 10, 2025

The openapi-typescript-codegen is now deprecated, the recommended alternative is @hey-api/openapi-ts
I saw this when I was reviewing options for adding schema suggestions etc to the YAML editor. Seems like the "schema.gen.ts" that can be generated could be useful for this.

There are some differences in how the types are generated:

  1. Now the types are all created in a single file, types.gen.ts, which is later renamed as index.ts
  2. ConditionType is now being generated correctly
  3. DeviceSystemInfo is generated with incorrect "additionalProperties" of type CustomInfo. I added a transformer that modifies the schema so it's generated correctly (as before).
  4. RolloutDeviceSelection is generated incorrectly, it should be a pure alias to BatchSequence (as before). I added a transformer for this too.
  5. There is a warning related to ESlint now when running "npm run lint", but it all seems to work fine.

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

78 files out of 179 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

{
name: '@hey-api/typescript',
enums: {
mode: 'typescript',
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

By default, enums would be created as types which would break a lot of our code.
Also, by default it uses the SCREAMING_SNAKE_CASE casing which would have required a lot more changes.

With the previous generator, only some types were using SCREAMING_SNAKE_CASE (eg. Event.type, etc)

@celdrake
Copy link
Collaborator Author

@coderabbitai The gist of this PR was to change the code generator for the Typescript types definitions.
The old generator produced one file per type, under /libs/types/models.
The new generator produces a single file for all types, which we rename to "index.ts"

There's no need to review the changes of the files removed at libs/types/models folder.

@coderabbitai
Copy link

coderabbitai bot commented Oct 10, 2025

Tip

For best results, initiate chat on the files or code changes.

@celdrake: Thank you for the clarification! I understand now - this PR migrates from openapi-typescript-codegen (which generated one file per type in /libs/types/models) to @hey-api/openapi-ts (which generates a single index.ts file with all types). I'll focus the review on:

  1. The new generator configuration and setup
  2. The transformers you added for DeviceSystemInfo and RolloutDeviceSelection
  3. The newly generated types in the single index.ts file
  4. Any integration changes needed due to the migration

I'll skip reviewing the deleted files in the /libs/types/models folder as those are simply being replaced by the new generation approach.


✏️ Learnings added
Learnt from: celdrake
URL: https://github.com/flightctl/flightctl-ui/pull/367

Timestamp: 2025-10-10T11:35:04.447Z
Learning: In the flightctl-ui repository, TypeScript types are generated using hey-api/openapi-ts and output to a single index.ts file (previously used openapi-typescript-codegen with one file per type under /libs/types/models).

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@celdrake celdrake force-pushed the migrate-deprecated-type-generator branch 2 times, most recently from 017be91 to 6ff93a7 Compare October 10, 2025 14:12
@celdrake celdrake force-pushed the migrate-deprecated-type-generator branch from 6ff93a7 to e4f82c0 Compare October 30, 2025 09:24
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.

1 participant