-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add "/" op and fix special cases in schema #122
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
toddbaert
force-pushed
the
fix/json-special-cases-and-divide
branch
from
January 12, 2024 17:23
5dd9633
to
1ce17ae
Compare
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
toddbaert
changed the title
fix: add divide and json special cases
fix: add divide and json fix special cases
Jan 12, 2024
toddbaert
commented
Jan 12, 2024
@@ -1,4 +1,5 @@ | |||
{ | |||
"$schema": "../../flagd-definitions.json", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every file in this folder just had the schema added, and then JSON formatted.
toddbaert
commented
Jan 12, 2024
}, | ||
"defaultVariant": "on", | ||
"targeting": { | ||
"*" : [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new test that tests EVERY single example from the JSONLogic site.
toddbaert
changed the title
fix: add divide and json fix special cases
fix: add "/" op and fix special cases in schema
Jan 12, 2024
beeme1mr
approved these changes
Jan 12, 2024
Kavindu-Dodan
approved these changes
Jan 12, 2024
thisthat
approved these changes
Jan 15, 2024
Merged
toddbaert
pushed a commit
that referenced
this pull request
Jan 15, 2024
🤖 I have created a release *beep* *boop* --- <details><summary>json/json-schema: 0.1.3</summary> ## [0.1.3](json/json-schema-v0.1.2...json/json-schema-v0.1.3) (2024-01-15) ### 🐛 Bug Fixes * add "/" op and fix special cases in schema ([#122](#122)) ([4a0be4f](4a0be4f)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
toddbaert
added a commit
to open-feature/flagd
that referenced
this pull request
Jan 17, 2024
Adds JSON schema at `https://flagd.dev/schema/v0/flagd-definitions.json`, which can be used to add validation to flagd config files. ~Note, to accomplish this cleanly, I have cloned the schemas module twice (at different versions) one is used for json releases (and tagged to something like `json/json-schema-v0.1.2`) while the other is for the protobuf generation and tagged to a release of that. I don't love this, but I think it's needed.~ I've decided against this. I don't think we'll really have conflicts here. See schema here: https://deploy-preview-1115--polite-licorice-3db33c.netlify.app/schema/v0/flagd-definitions.json Once this is available, I intend to update a bunch of docs and examples to leverage this schema, and and an blurb in the docs about it. ~Blocked by: open-feature/flagd-schemas#122 ~I think I'll wait for [this](#1146) to be done before adding this, to avoid conflicts.~ --------- Signed-off-by: Todd Baert <todd.baert@dynatrace.com> Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After @thisthat noticed I was missing "/", I added a test that with a massive targeting rule that doesn't make sense in terms of feature flagging, but uses every single default JSON logic op in their various forms. In doing that I found a missed a few special cases:
missing special cases:
"+" can be used with a single param to cast to number
"-" can be used with a single param to multiply by -1
"substr" can be used with 3 args to to return a "middle" substring
bugs:
"reduce" needs 3 args
"max/min" take an array directly and no mapper function, so they can take any amount of args
"<" and "<=" require at least 2 args