Skip to content

feat: change jsonschema parser#1794

Merged
toddbaert merged 1 commit into
open-feature:mainfrom
open-feature-forking:feat/change_json_parser_integration
Sep 8, 2025
Merged

feat: change jsonschema parser#1794
toddbaert merged 1 commit into
open-feature:mainfrom
open-feature-forking:feat/change_json_parser_integration

Conversation

@aepfli

@aepfli aepfli commented Sep 4, 2025

Copy link
Copy Markdown
Member

No description provided.

@aepfli aepfli requested review from a team as code owners September 4, 2025 10:12
@netlify

netlify Bot commented Sep 4, 2025

Copy link
Copy Markdown

Deploy Preview for polite-licorice-3db33c canceled.

Name Link
🔨 Latest commit 3d095a6
🔍 Latest deploy log https://app.netlify.com/projects/polite-licorice-3db33c/deploys/68b967dc63c05800086268b8

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 4, 2025

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Summary of Changes

Hello @aepfli, 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 focuses on modernizing the JSON schema validation process by replacing the existing parser with a new, more robust library. The change required significant refactoring of the schema compilation and validation mechanisms within the evaluator, ensuring that flag definitions continue to be validated effectively with an updated foundation.

Highlights

  • JSON Schema Parser Migration: The primary change involves migrating the JSON schema validation library from github.com/xeipuuv/gojsonschema to github.com/santhosh-tekuri/jsonschema/v6. This updates the underlying mechanism for validating flag definitions.
  • Schema Compilation Refactor: The internal logic for loading and compiling JSON schemas has been refactored to integrate with the new parser. This includes introducing a new helper function addSchemaResource and updating the JSON evaluator's constructor to compile schemas using the santhosh-tekuri/jsonschema/v6 library.
  • Test Suite Adjustments: The test file json_test.go has been updated to align with the new parser implementation. This involved changing its package name, adjusting imports, renaming a key test variable (Flags to flagConfig), and updating test calls to reflect these changes.
  • Mock Interface Updates: Minor adjustments were made to mock interfaces in ievaluator.go and http.go, including the removal of isgomock fields and an update to the SetState return type in the evaluator mock. A new MockCron interface was also added in http.go.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 refactors the JSON schema validation by replacing the xeipuuv/gojsonschema library with santhosh-tekuri/jsonschema/v6. The changes are mainly in core/pkg/evaluator/json.go and its corresponding test file. The new library is used to compile and validate flag definition schemas during initialization and state updates.

My review focuses on ensuring the new implementation is robust and correct. I've identified a critical issue where a schema compilation failure during startup could lead to a panic. I've also included some suggestions for code improvement and cleanup, such as removing an unused import, an unused function parameter, and improving the handling of schema validation errors. The test files have been updated correctly to reflect the package and logic changes.

Comment thread core/pkg/evaluator/json.go
Comment thread core/pkg/evaluator/json.go Outdated
Comment thread core/pkg/evaluator/json.go Outdated
Comment thread core/pkg/evaluator/json.go
@aepfli aepfli force-pushed the feat/change_json_parser_integration branch 2 times, most recently from c072354 to 794da0b Compare September 4, 2025 10:18
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
@aepfli aepfli force-pushed the feat/change_json_parser_integration branch from 794da0b to 3d095a6 Compare September 4, 2025 10:20

@toddbaert toddbaert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small one, merging.

@toddbaert toddbaert merged commit bf3f722 into open-feature:main Sep 8, 2025
15 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 4, 2025
@aepfli aepfli deleted the feat/change_json_parser_integration branch September 8, 2025 13:58
thisthat pushed a commit to thisthat/flagd that referenced this pull request Sep 29, 2025
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Giovanni Liva <giovanni.liva@dynatrace.com>
toddbaert added a commit that referenced this pull request Dec 24, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>flagd: 0.13.0</summary>

##
[0.13.0](flagd/v0.12.9...flagd/v0.13.0)
(2025-12-23)


### 🐛 Bug Fixes

* fixing sync return format missing flag layer, adding full e2e suite
([#1827](#1827))
([570693d](570693d))
* **security:** update module github.com/go-viper/mapstructure/v2 to
v2.4.0 [security]
([#1784](#1784))
([037e30b](037e30b))
* **security:** update module golang.org/x/crypto to v0.45.0 [security]
([#1826](#1826))
([7e0762b](7e0762b))


### ✨ New Features

* add support for http-based ofrep metrics
([#1803](#1803))
([fcd19b3](fcd19b3))
* cleanup evaluator interface
([#1793](#1793))
([aa504f7](aa504f7))
* enable parsing of array flag configurations for flagd
([#1797](#1797))
([97c6ffa](97c6ffa))
* multi-project support via selectors and flagSetId namespacing
([#1702](#1702))
([f9ce46f](f9ce46f))
* normalize selector in sync (use header as in OFREP and RPC)
([#1815](#1815))
([c1f06cb](c1f06cb))


### 🧹 Chore

* **refactor:** use memdb for flag storage
([#1697](#1697))
([5c5c1cf](5c5c1cf))


### 🔄 Refactoring

* store cleanup
([#1705](#1705))
([bcff8d7](bcff8d7))
</details>

<details><summary>flagd-proxy: 0.8.1</summary>

##
[0.8.1](flagd-proxy/v0.8.0...flagd-proxy/v0.8.1)
(2025-12-23)


### 🐛 Bug Fixes

* **security:** update module github.com/go-viper/mapstructure/v2 to
v2.4.0 [security]
([#1784](#1784))
([037e30b](037e30b))
* **security:** update module golang.org/x/crypto to v0.45.0 [security]
([#1826](#1826))
([7e0762b](7e0762b))
</details>

<details><summary>core: 0.13.0</summary>

##
[0.13.0](core/v0.12.1...core/v0.13.0)
(2025-12-23)


### ⚠ BREAKING CHANGES

* enable parsing of array flag configurations for flagd
([#1797](#1797))
* cleanup evaluator interface
([#1793](#1793))
* removes the `fractionalEvaluation` operator since it has been replaced
with `fractional`.
([#1704](#1704))

### 🐛 Bug Fixes

* **security:** update module github.com/go-viper/mapstructure/v2 to
v2.4.0 [security]
([#1784](#1784))
([037e30b](037e30b))
* **security:** update module golang.org/x/crypto to v0.45.0 [security]
([#1825](#1825))
([44edcc9](44edcc9))
* **security:** update module golang.org/x/crypto to v0.45.0 [security]
([#1826](#1826))
([7e0762b](7e0762b))


### ✨ New Features

* Add OAuth support for HTTP Sync
([#1791](#1791))
([268fd75](268fd75))
* Add OTEL default variables
([#1812](#1812))
([c2e3fc6](c2e3fc6))
* allow null flagSetId Selector, restrict Selector to single
key-value-pairs
([#1708](#1708))
([#1811](#1811))
([c12a0ae](c12a0ae))
* change jsonschema parser
([#1794](#1794))
([bf3f722](bf3f722))
* cleanup evaluator interface
([#1793](#1793))
([aa504f7](aa504f7))
* enable parsing of array flag configurations for flagd
([#1797](#1797))
([97c6ffa](97c6ffa))
* multi-project support via selectors and flagSetId namespacing
([#1702](#1702))
([f9ce46f](f9ce46f))


### 🧹 Chore

* **refactor:** use memdb for flag storage
([#1697](#1697))
([5c5c1cf](5c5c1cf))
* removes the `fractionalEvaluation` operator since it has been replaced
with `fractional`.
([#1704](#1704))
([3228ad8](3228ad8))


### 🔄 Refactoring

* remove deprecated bearerToken option
([#1816](#1816))
([efda06a](efda06a))
* removed unused Selector from Flag and Store.
([#1747](#1747))
([1083005](1083005))
* store cleanup
([#1705](#1705))
([bcff8d7](bcff8d7))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Signed-off-by: OpenFeature Bot <109696520+openfeaturebot@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants