refactor(flagd): Remove HTTP call when validating JSON schema#547
Conversation
Signed-off-by: Kyle Julian <[email protected]>
Summary of ChangesHello @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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
test/OpenFeature.Contrib.Providers.Flagd.Test/JsonSchemaValidatorTests.cs
Outdated
Show resolved
Hide resolved
...nFeature.Contrib.Providers.Flagd/Resolver/InProcess/FlagdJsonSchemaEmbeddedResourceReader.cs
Outdated
Show resolved
Hide resolved
src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/JsonSchemaValidator.cs
Show resolved
Hide resolved
Signed-off-by: Kyle Julian <[email protected]>
askpt
left a comment
There was a problem hiding this comment.
I have three major concerns with this PR:
- NativeAoT with reflection. See comment.
- enabling nullables in new classes. See comment.
- Copy of the
flags.jsonandtargeting.json. For this one, please have a look into the submodule calledflagd-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!
...nFeature.Contrib.Providers.Flagd/Resolver/InProcess/FlagdJsonSchemaEmbeddedResourceReader.cs
Outdated
Show resolved
Hide resolved
...nFeature.Contrib.Providers.Flagd/Resolver/InProcess/FlagdJsonSchemaEmbeddedResourceReader.cs
Show resolved
Hide resolved
Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
...nFeature.Contrib.Providers.Flagd/Resolver/InProcess/FlagdJsonSchemaEmbeddedResourceReader.cs
Outdated
Show resolved
Hide resolved
src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/IFlagdJsonSchemaProvider.cs
Show resolved
Hide resolved
Signed-off-by: Kyle Julian <[email protected]>
Signed-off-by: Kyle Julian <[email protected]>
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