Skip to content
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

json-filter #81

Closed
46 tasks done
streamich opened this issue Nov 3, 2021 · 1 comment · Fixed by #105
Closed
46 tasks done

json-filter #81

streamich opened this issue Nov 3, 2021 · 1 comment · Fixed by #105

Comments

@streamich
Copy link
Owner

streamich commented Nov 3, 2021

  • Implement JSON filtering language: given a filter specification in JSON and a JSON document, the filter returns true or false.
  • Return schema complexity estimate at compilation time? Complexity could be expressed as the number of JavaScript expressions.
  • On schema evaluation, return the number of JavaScript expressions evaluated?
  • Codegen for json-expression.
    • ExprGet
    • ExprEquals
    • ExprNotEquals
    • ExprIf
    • ExprAnd
    • ExprOr
    • ExprNot
    • ExprType
    • ExprBool
    • ExprNum
    • ExprInt
    • ExprStr
    • ExprStarts
    • ExprContains
    • ExprEnds
    • ExprDefined
    • ExprIn
    • ExprMatches
    • ExprCat
    • ExprSubstr
    • ExprLessThan
    • ExprLessThanOrEqual
    • ExprGreaterThan
    • ExprGreaterThanOrEqual
    • ExprBetweenNeNe
    • ExprBetweenNeEq
    • ExprBetweenEqNe
    • ExprBetweenEqEq
    • ExprMin
    • ExprMax
    • ExprPlus
    • ExprMinus
    • ExprAsterisk
    • ExprSlash
    • ExprMod
    • ExprRound
    • ExprCeil
    • ExprFloor
  • Ability to provide default value for json-expression "get" operator if value not found.
  • json-expression should throw on any undefined values? As undefined is not part of JSON and is unique to JavaScript.
  • Implement benchmarks
    • codegen vs evaluator
    • vs JSON Logic
    • vs JSON patch
  • Implement AWS SNS filtering rule compiler to json-expression
  • Add README. Name it JSON Expression.


It could be called json-expressions and implement basic expressions, like:

['and',
    ['starts', 'mu.bl/:posts-', ['get', '/req/id']],
    ['<', ['len', ['get', '/req/batch']], 5]
]
 
['add', '/tmp/userId', ['val', 'xxxxxxxx']]

['and',
    ['==',
    	'document-123',
     	['get', '/channel']],
    ['==',
     	'mousemove',
     	['get', '/data/type']],
    ['<',
     	123234343433,
     	['get', '/data/timestamp']],
    ['in', ['get', '/data/customer_interests'], [[
      "rugby",
      "football",
      "baseball"
   ]]]
]

Alternatively, a more advanced version of this could treat everything as function:

['map', [[1, 2, 3]], ['*', 2]] // [2, 4, 6]
@streamich streamich created this issue from a note in Kanban board (To do) Nov 3, 2021
@streamich streamich moved this from To do to Needs clarification in Kanban board Nov 9, 2021
@streamich streamich moved this from Needs clarification to In progress in Kanban board Nov 25, 2021
@streamich streamich mentioned this issue Nov 27, 2021
5 tasks
Kanban board automation moved this from In progress 🏎 to Done 👍 Dec 9, 2021
@streamich
Copy link
Owner Author

🎉 This issue has been resolved in version 6.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Kanban board
Done 👍
Development

Successfully merging a pull request may close this issue.

1 participant