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

feat(jmespath): add tree interpreter #2265

Merged
merged 4 commits into from
Mar 27, 2024
Merged

Conversation

dreamorosi
Copy link
Contributor

Description of your changes

This PR adds a TreeInterpreter class to the JMESPath utility.

The tree interpreter serves as a component responsible for evaluating the Abstract Syntax Tree (AST) generated during the parsing process against a given JSON document.

The purpose of the tree interpreter is to interpret the meaning of the JMESPath expression represented by the AST and to extract the relevant data from the JSON document accordingly.

Related issues, RFCs

Issue number: #2209

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective and works
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Mar 21, 2024
@dreamorosi dreamorosi requested review from a team as code owners March 21, 2024 16:13
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Mar 21, 2024
@dreamorosi dreamorosi linked an issue Mar 21, 2024 that may be closed by this pull request
2 tasks
@github-actions github-actions bot added the feature PRs that introduce new features or minor changes label Mar 21, 2024
@dreamorosi dreamorosi requested a review from sthulb March 21, 2024 16:15
@sthulb
Copy link
Contributor

sthulb commented Mar 24, 2024

I feel like tests are require here.

@sthulb sthulb marked this pull request as draft March 24, 2024 19:22
@dreamorosi
Copy link
Contributor Author

I feel like tests are require here.

Agree, and I have implemented them.

I have around 900 unit tests with 100% coverage that you can see in the feat/jmespath branch, here.

Initially the whole implementation of this utility was in a single PR but I decided to break it down into smaller PRs to make the review easier.

Breaking down the implementation into separate PRs was fairly easy but doing the same for the tests will take many hours. My plan was to get this plus 2 subsequent PRs for the remainder of the implementation and then open a PR dedicated to adding tests only (again, their implementation is there already).

If I merged the tests now we'd have CI red because some of the tests would fail due to missing modules that will be added in the next 2 PRs.

Also, the JMESPath module is currently marked as private, so even if we made a release right now it would not get published.

Do you think this would work? Otherwise I can put the remainder of the implementation plus the tests in this PR, but that'll result in over a thousand LOC (primarily due to the test spec being verbose).

Let me know how you'd like to proceed @sthulb.

@dreamorosi dreamorosi marked this pull request as ready for review March 25, 2024 10:10
@dreamorosi
Copy link
Contributor Author

The tests that will cover this and all other JMESPath PRs are in this PR: #2271

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@dreamorosi dreamorosi merged commit b54eb9c into main Mar 27, 2024
11 checks passed
@dreamorosi dreamorosi deleted the feat/jmespath_treeinterpreter branch March 27, 2024 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature PRs that introduce new features or minor changes size/L PRs between 100-499 LOC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: JMESPath tree interpreter
2 participants