-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: Add JP version and regex operations in jsonlogic #73
Conversation
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.
Lack of support for android webviews means this won't work with SDK. Is that fine?
Cargo.toml
Outdated
@@ -41,7 +41,7 @@ chrono = { version = "0.4.26", features = ["serde"] } | |||
uuid = {version = "1.3.4", features = ["v4", "serde"]} | |||
reqwest = { version = "0.11.18", features = ["json"]} | |||
jsonschema = "~0.17" | |||
jsonlogic = "0.5.1" | |||
jsonlogic = { git = "https://github.com/juspay/jsonlogic_rs.git", rev = "4f1a8bcbb423c599eacf6c95ae17f5c0974bc071" } |
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.
Why did we make this change? All other changes are in JS
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.
to add the same operators in the rust client
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.
Are those added in this PR? If not, can we make this change when we add the operations
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.
clients/js/src/index.ts
Outdated
jsonLogic.add_operation("match", matchRegex); | ||
jsonLogic.add_operation("semver_eq", compareSemanticIsEqual); | ||
jsonLogic.add_operation("semver_gt", compareSemanticIsGreater); | ||
jsonLogic.add_operation("semver_gteq", compareSemanticIsGreaterEqual); |
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.
jsonLogic.add_operation("semver_gteq", compareSemanticIsGreaterEqual); | |
jsonLogic.add_operation("semver_ge", compareSemanticIsGreaterEqual); |
clients/js/src/index.ts
Outdated
jsonLogic.add_operation("semver_gt", compareSemanticIsGreater); | ||
jsonLogic.add_operation("semver_gteq", compareSemanticIsGreaterEqual); | ||
jsonLogic.add_operation("semver_lt", compareSemanticIsLesser); | ||
jsonLogic.add_operation("semver_lteq", compareSemanticIsLesserEqual); |
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.
jsonLogic.add_operation("semver_lteq", compareSemanticIsLesserEqual); | |
jsonLogic.add_operation("semver_le", compareSemanticIsLesserEqual); |
const compareSemanticIsGreaterImp = function (version_a: string, version_b: string) { | ||
return version_a.localeCompare(version_b, undefined, {numeric:true, sensitivity:'base'}) > 0; | ||
const compareSemantic = function (version_a: string, version_b: string): number { | ||
return version_a.localeCompare(version_b, undefined, { numeric: true, sensitivity: 'base' }); |
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.
the locales
parameter and options
parameter are not supported on android webview
clients/js/src/index.ts
Outdated
jsonLogic.add_operation("match", matchRegex); | ||
jsonLogic.add_operation("semver_eq", compareSemanticIsEqual); | ||
jsonLogic.add_operation("semver_gt", compareSemanticIsGreater); | ||
jsonLogic.add_operation("semver_gteq", compareSemanticIsGreaterEqual); |
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.
@ayushjain17 should we add one for between also ?
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.
@pratikmishra356 less than supports between operation as well, the behaviour of these version comparison operators are same as that of the normal comparison operators - wrt the number of operators
627c264
to
83d34bf
Compare
416da02
to
9bca3e5
Compare
a390d37
to
f9f0e5a
Compare
@@ -41,7 +41,7 @@ chrono = { version = "0.4.26", features = ["serde"] } | |||
uuid = {version = "1.3.4", features = ["v4", "serde"]} | |||
reqwest = { version = "0.11.18", features = ["json"]} | |||
jsonschema = "~0.17" | |||
jsonlogic = "0.5.1" | |||
jsonlogic = { git = "https://github.com/juspay/jsonlogic_rs.git", version = "0.5.2" } |
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.
Why add this without rust changes?
Problem
Semantic versioning and regex related operations not present in jsonlogic
Solution
Add semver and regex operations in jsonlogic