Project

General

Profile

Actions

Task #3392

closed

Revision of JPath library

Added by Jan Mach over 7 years ago. Updated 4 months ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
Development - Core
Target version:
Start date:
03/25/2017
Due date:
% Done:

0%

Estimated time:
To be discussed:

Description

Because mentat-inspector.py is currently being heavily used and expectations are getting bigger, it would be wise to perform revision of the library and finish the implementation, so that everything works as expected and mentat-inspector.py delivers.

JPath is simplified version of JSONPath and can be used to addressing nodes within arbitrary data structure composed of dict-like and list-like objects. Basically it can be used for any data structure of objects implementing Python list and/or dict interface.

The motivation for implementing this module were following two use cases:

  1. Writing of simple rules in filtering expressions, for example:
        Source.IP4 in [192.168.0.0/24, 192.168.0.0/24]
# Simple message modifications based on the key => value rules, for example:
        "Source[1].Type[*]" = "source type tag" 

The obvious first choice as a solution was the jsonpath-rw library. The full JSONPath however seems to be too big of a gun for our needs and in some cases it could even enable users to cut branch they are sitting on. For this reason we have designed this simplified version with only basic features.

Documentation must contain examples for common use cases.


Related issues

Related to Mentat - Task #3393: Revision of pynspect libraryClosedJan Mach03/25/2017

Actions
Actions #1

Updated by Jan Mach over 7 years ago

  • Description updated (diff)
Actions #2

Updated by Jan Mach over 7 years ago

  • Status changed from New to Feedback
  • Assignee changed from Jan Mach to Pavel Kácha
  • Priority changed from High to Normal

Because mentat-inspector.py is currently being heavily used and needs to meet expectations, I have made many improvements in key library JPath. I have polished the whole library, added documentation and unit tests. Now we should be sure, what exactly the library is capable of, know possible drawbacks and in case of need we can think of possible improvements. Reading the documentation at the head of the file should be sufficient before discussions.

Besides general polishing, I have implemented support for appending values into array, as was requested by email. However, it is currently not deployed on production server.

Actions #3

Updated by Pavel Kácha over 7 years ago

  • Assignee changed from Pavel Kácha to Jan Mach

Takže chápu-li to dobře, # přidává dict a položky do něj, * list a položky do něj?

Actions #4

Updated by Jan Mach over 7 years ago

  • Status changed from Feedback to In Progress

At next face to face meeting consider following options:

  1. Support for unique sets of values
  2. Start indexing at value '0' instead of '1'
  3. Remove '*' index in favor of empty brackets '[]', or use them as alternative syntax
  4. Change syntax for better support of lists to:
    Node.[1].FirstSubelement.ListAttribute.[1]
Actions #5

Updated by Jan Mach over 7 years ago

  • Related to Task #3393: Revision of pynspect library added
Actions #6

Updated by Pavel Kácha over 7 years ago

Resolutions from meeting:

  • overwrite and unique added as part of api, but not part of syntax (#3396, #3372)
  • zero based indexing - yes
  • Node[1].FirstSubelement.ListAttribute[1] is still fine, separator is (".", "["), trailing "]" then distinguishes object and array subscripts.
  • Let's stay with asterisk (Node[*]), we don't particularly like it, but it's explicit and consistent with possible extension to object notation (_CESNET.*).
Actions #7

Updated by Jan Mach over 7 years ago

  • Description updated (diff)

Documentation must contain examples for common use cases.

Actions #8

Updated by Jan Mach over 6 years ago

  • Target version changed from 2.0 to Backlog
  • Parent task deleted (#3376)
Actions #9

Updated by Pavel Kácha over 3 years ago

  • Assignee deleted (Jan Mach)
Actions #10

Updated by Pavel Kácha 7 months ago

  • Status changed from In Progress to Rejected

Most probably will end up differently during Pynspect revamp.

Actions #11

Updated by Rajmund Hruška 4 months ago

  • Target version changed from Backlog to Rejected
Actions

Also available in: Atom PDF