Skip to content

Conversation

@tomflenner
Copy link

This PR

  • Adds Angular code generation support to the OpenFeature CLI
  • Generates type-safe Angular service wrapping the OpenFeature Angular SDK
  • Generates structural directives for each feature flag (boolean, string, number, object)
  • Adds integration tests for Angular code generation

Related Issues

Fixes #202

Notes

This implementation follows the existing pattern established by the React generator, leveraging the official @openfeature/angular-sdk rather than reimplementing core functionality.

Structural Directives Approach:
The generated directives use Angular's hostDirectives feature to wrap the SDK's built-in directives (BooleanFeatureFlagDirective, StringFeatureFlagDirective, etc.) with pre-configured flag keys and default values. This approach:

  • Provides type-safe, flag-specific directives for template usage
  • Leverages existing SDK functionality rather than reimplementing it
  • Maintains consistency with the SDK's directive inputs for advanced configuration
  • Example: *enableFeatureA directive automatically configures the underlying BooleanFeatureFlagDirective

This design choice prioritizes developer experience (pre-configured, type-safe directives) while maintaining flexibility through the underlying SDK's input parameters.

Acknowledgments:

  • Shout-out to my frontend teammate at DataGalaxy for the initial review and valuable feedback internally
  • Code generation assisted by Claude Opus 4.5

Follow-up Tasks

  • Consider gathering community feedback on the structural directive implementation approach

How to test

  1. Run the integration test suite using make test-integration
  2. Generate Angular code from a sample configuration:
openfeature generate angular -i path/to/manifest.json -o output/directory

@gemini-code-assist
Copy link

Summary of Changes

Hello @tomflenner, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the OpenFeature CLI by integrating robust Angular code generation capabilities. It allows developers to automatically create type-safe Angular services and structural directives directly from their feature flag manifests. This not only improves developer experience by reducing boilerplate and ensuring type safety but also promotes consistent and idiomatic usage of OpenFeature within Angular applications, mirroring patterns established by existing React generators.

Highlights

  • Angular Code Generation: Introduces a new generate angular command to the OpenFeature CLI, enabling the creation of type-safe Angular services and directives.
  • Type-Safe Services: Generates an Angular service that wraps the official OpenFeature Angular SDK, providing strongly-typed methods for accessing feature flag details.
  • Structural Directives: Implements structural directives for each feature flag type (boolean, string, number, object), leveraging Angular's hostDirectives for pre-configured, type-safe template usage.
  • Comprehensive Testing: Adds a dedicated integration test suite for the Angular generator, covering compilation, service functionality, and directive behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- Add GeneratedFeatureFlagService with typed methods for each flag
- Add structural directives using hostDirectives pattern
- Support domain parameter for provider scoping
- Generate FlagKeys constant and FlagKey type
- Export GeneratedFeatureFlagDirectives array for easy imports

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
- Register angular generator in generate command
- Add documentation for openfeature generate angular

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
- Add golden file test for angular generation
- Add custom template test for angular
- Update .gitignore to exclude generated test files

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
- Add Vitest-based test setup for Angular 19
- Add compilation tests for generated exports
- Add service tests for GeneratedFeatureFlagService
- Add directive tests for all flag types (boolean, string, number, object)
- Use domain isolation with uuid for test independence

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
- Add Dagger-based Angular integration test runner
- Register angular test in main integration test runner

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
@tomflenner tomflenner force-pushed the 202-angular-generator branch from 97d8aab to 4df24f3 Compare January 27, 2026 11:34
Copy link

@gemini-code-assist gemini-code-assist 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 pull request introduces comprehensive support for Angular code generation within the OpenFeature CLI. It includes the addition of a new angular command, the implementation of the generator logic in Go, and a detailed template for generating type-safe Angular services and structural directives. Furthermore, a robust integration test suite has been added, leveraging Dagger, Vitest, and Angular's testing utilities to ensure the correctness and functionality of the generated code. The changes are well-structured and align with the existing patterns in the CLI. No issues were found that require immediate attention or fall into the critical, high, or medium severity categories.

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
Signed-off-by: backtrack5r3 <flennertom@gmail.com>
@tomflenner tomflenner force-pushed the 202-angular-generator branch from bb103a7 to 8fd2aa9 Compare January 27, 2026 11:44
Signed-off-by: backtrack5r3 <flennertom@gmail.com>
Signed-off-by: backtrack5r3 <flennertom@gmail.com>
Remove old generated interface that was not used

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
See angular/angular#50510

Signed-off-by: backtrack5r3 <flennertom@gmail.com>
@tomflenner tomflenner force-pushed the 202-angular-generator branch from 1e6c866 to 0cd3256 Compare January 30, 2026 15:25
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.

feat: support angular generator

1 participant