-
-
Notifications
You must be signed in to change notification settings - Fork 401
feat: const object-style enum generation #1281
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
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 9d1d74e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
e92ab65
to
ef626cf
Compare
I'm not clear on how best to extend this to the inline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements the generation of enums as pairs of const objects and derived types, making this behavior mutually exclusive with the union enums generation. Key changes include updating configuration interfaces, modifications to the CLI, updates in the schema formatter to support const object enums, and new tests and snapshots covering this feature.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
types/index.ts | Added the generateConstObjectEnums flag in API parameters and configuration. |
tests/spec/constObjectEnums/schema.json | New schema file for testing const object enum generation. |
tests/spec/constObjectEnums/basic.test.ts | Added test to validate const object enums generation. |
tests/spec/constObjectEnums/snapshots/basic.test.ts.snap | Updated snapshot reflecting the new const object enums. |
templates/base/data-contracts.ejs | Added template support for const object enums. |
src/schema-parser/schema-formatters.ts | Updated schema formatting to generate const object enums when enabled. |
src/configuration.ts | Updated configuration to include the new generateConstObjectEnums flag. |
index.ts | Included the new CLI flag and passed the option to the API generator. |
Comments suppressed due to low confidence (2)
index.ts:184
- Consider clarifying in the CLI flag description that this option is mutually exclusive with generateUnionEnums to ensure consistency with the documentation provided in the API interface comments.
"generate-const-object-enums": {
src/schema-parser/schema-formatters.ts:41
- [nitpick] Ensure that the generated code block for const object enums adheres to consistent formatting standards (e.g., semicolon usage and newlines) across all generated files.
typeIdentifier: this.config.Ts.Keyword.Const,
bugbot run |
🚨 BugBot couldn't runPull requests from forked repositories are not yet supported (requestId: serverGenReqId_5bf595eb-a690-4534-8c07-4a24d2f0a837). |
…TypeScript enum keyword objects. Closes acacode#1040.
d7169f5
to
9d1d74e
Compare
Closes #1040.