feat: add JSON Schema validation for Flagd provider when in-process mode is used - #373
Conversation
* Fix unit tests failing due to change in constructor * Add initial documentation to README * Add ILogger to provider config Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
askpt
left a comment
There was a problem hiding this comment.
Just a minor comment in relation to the NJsonSchema version. The rest are minor nitpicks. Great job!
| <!-- The generated files will be placed in ./obj/Debug/netstandard2.0/Protos --> | ||
| <PackageReference Include="JsonLogic" Version="5.4.0" /> | ||
| <PackageReference Include="murmurhash" Version="1.0.3" /> | ||
| <PackageReference Include="NJsonSchema" Version="11.2.0" /> |
There was a problem hiding this comment.
Will you get a lot of breaking changes if you lower to 11.0.0? Since we are publishing this dependency (NJsonSchema), we shouldn't enforce newest versions.
There was a problem hiding this comment.
Have bumped it down to 11.0.0, you're right there is no need to tie Flagd to 11.2 if it works just as well at 11.0
| return; | ||
| } | ||
|
|
||
| #if NET5_0_OR_GREATER |
There was a problem hiding this comment.
Not as part of this PR, but we should bump the target framework...
| var jsonSchemaValidator = Substitute.For<IJsonSchemaValidator>(); | ||
|
|
||
| var jsonEvaluator = new JsonEvaluator(fixture.Create<string>()); | ||
| var jsonEvaluator = new JsonEvaluator(fixture.Create<string>(), jsonSchemaValidator); |
There was a problem hiding this comment.
A lot of copy-paste here. I think we should move into a ctor, and control the flow here if needs any change.
There was a problem hiding this comment.
I have refactored these tests now to have the constructor initialise the JsonEvaluator. A lot of duplicated code removed now 😄
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com>
Signed-off-by: André Silva <2493377+askpt@users.noreply.github.com> # Conflicts: # src/OpenFeature.Contrib.Providers.Flagd/Resolver/InProcess/InProcessResolver.cs
…ode is used (open-feature#373) Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com> Co-authored-by: André Silva <2493377+askpt@users.noreply.github.com> Signed-off-by: Weyert de Boer <weyert@innerfuse.biz>
…ode is used (open-feature#373) Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com> Co-authored-by: André Silva <2493377+askpt@users.noreply.github.com>
…ode is used (open-feature#373) Signed-off-by: Kyle Julian <38759683+kylejuliandev@users.noreply.github.com> Co-authored-by: André Silva <2493377+askpt@users.noreply.github.com> Signed-off-by: Weyert de Boer <weyert@innerfuse.biz>
This PR
Related Issues
Fixes #226
Notes
Not yet quite finished. Needs some unit tests. Initial testing locally seems to suggest it is working as expected
I'm not sure how keen I am on extending FlagdConfig.cs with ILogger. An alternative approach might be to make it more first class by tweaking the constructor of the FlagdProvider.cs
Follow-up Tasks
How to test