Skip to content

refactor(flagd): Remove HTTP call when validating JSON schema#547

Merged
askpt merged 10 commits intoopen-feature:mainfrom
kylejuliandev:fetch-schema-from-embedded-resource
Feb 2, 2026
Merged

refactor(flagd): Remove HTTP call when validating JSON schema#547
askpt merged 10 commits intoopen-feature:mainfrom
kylejuliandev:fetch-schema-from-embedded-resource

Conversation

@kylejuliandev
Copy link
Contributor

This PR

Refactors the Json Schema Validator in the Flagd provider to use embedded JSON resources instead of relying on HTTP to call out to flagd.dev. I've added a IFlagdJsonSchemaProvider which we may chose to expose to developers in the event they want to provide their own implementations. At the moment this is flagged as internal. I've removed the HTTP code as this was causing issues and this aligns the implementation with how the Java implementation does it.

Related Issues

Fixes #474

Notes

Follow-up Tasks

How to test

@kylejuliandev kylejuliandev added the provider:flagd Issues related to provider flagd label Jan 15, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kylejuliandev, 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 refactors the JSON schema validation within the Flagd provider by transitioning from external HTTP-based schema retrieval to using embedded resources. This change enhances the robustness and reliability of the provider by removing a critical external dependency that was causing issues. It also introduces a clear abstraction for schema provision, aligning the implementation with best practices seen in other language SDKs.

Highlights

  • Removed HTTP Dependency: The JSON schema validation process no longer relies on external HTTP calls to flagd.dev, eliminating potential network issues and external dependencies.
  • Embedded JSON Schemas: Flagd JSON schemas for 'flags' and 'targeting' are now embedded directly into the assembly as resources, ensuring their availability offline and improving reliability.
  • Introduced Schema Provider Interface: A new interface, IFlagdJsonSchemaProvider, has been added to abstract the mechanism of reading Flagd JSON schemas, allowing for custom implementations if needed (though currently internal).
  • Refactored JSON Schema Validator: The JsonSchemaValidator has been updated to utilize the new IFlagdJsonSchemaProvider for schema retrieval, simplifying its constructor and removing HttpClient dependencies.
  • Improved Test Coverage: Existing tests for JsonSchemaValidator have been updated to reflect the removal of HTTP dependencies, and new tests have been added for the FlagdJsonSchemaEmbeddedResourceReader to ensure embedded schemas are correctly loaded.
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.

Copy link
Contributor

@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 is a solid refactoring that removes the HTTP dependency for JSON schema validation, replacing it with embedded resources. This change improves reliability and aligns the implementation with other flagd providers. The introduction of the IFlagdJsonSchemaProvider interface is a great addition for modularity and testability. I've identified a couple of minor issues in the implementation and a bug in one of the tests that should be addressed.

Signed-off-by: Kyle Julian <[email protected]>
@kylejuliandev kylejuliandev marked this pull request as ready for review January 15, 2026 22:43
@kylejuliandev kylejuliandev requested review from a team as code owners January 15, 2026 22:43
@kylejuliandev kylejuliandev changed the title refactor: Remove HTTP call when validing JSON schema refactor: Remove HTTP call when validating JSON schema Jan 16, 2026
Copy link
Member

@askpt askpt left a comment

Choose a reason for hiding this comment

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

I have three major concerns with this PR:

  1. NativeAoT with reflection. See comment.
  2. enabling nullables in new classes. See comment.
  3. Copy of the flags.json and targeting.json. For this one, please have a look into the submodule called flagd-schemas. It includes these files and we can leverage them being already in the repository instead of copy-pasta.

Other than that looks good to me! Thank you!

@kylejuliandev kylejuliandev changed the title refactor: Remove HTTP call when validating JSON schema refactor(flagd): Remove HTTP call when validating JSON schema Jan 20, 2026
@askpt askpt requested review from beeme1mr, benjiro and chrfwow January 22, 2026 17:48
@askpt askpt added this pull request to the merge queue Feb 2, 2026
Merged via the queue into open-feature:main with commit 8ed7f04 Feb 2, 2026
11 checks passed
@kylejuliandev kylejuliandev deleted the fetch-schema-from-embedded-resource branch February 3, 2026 17:30
This was referenced Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:flagd Issues related to provider flagd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InProcessResolver JsonSchemaValidator should be able to get the targeting.json and flags.json without calling flagd.dev

5 participants