Skip to content

Conversation

@robin-aws
Copy link
Contributor

@robin-aws robin-aws commented Dec 5, 2025

Background

  • What do these changes do?
    • Adds the ability to evaluate JmespathExpressions
      • Defines a JmespathRuntime<T> interface to provide the necessary basic operations on JSON values at runtime.
      • The actual Evaluator is largely ported over from smithy-java's JMESPathDocumentQuery, but also taking some inspiration from jmespath-java, which also has a generic interface for adapting any existing JSON value representation.
    • Adds JmespathRuntime<T> implementations for both LiteralExpression and Node.
    • Adds a separate smithy-jmespath-tests module with the compliance tests from https://github.com/jmespath/jmespath.test, and instantiates them for both runtime implementations.
  • Why are they important?
    • The existing smithy-java evaluator only works on its own Document type, and evaluating expressions on generated types such as SerializableStruct subtypes currently requires first converting to a Document, which is slow. I've also written up implementations of JmespathRuntime for Document and generated types: see smithy-java link below.
    • JMESPath expressions are very easy to get wrong. The existing type checker/linter helps catch egregious errors but is far from complete. Having an interpreter opens the door to features where models can provide examples/tests of their expressions, possibly using the pending @shapeExamples trait (Add new shapeExamples trait that communicates and enforces allowed and disallowed values #2851)

Testing

  • How did you test these changes?
    • Mainly existing regression tests and the new smithy-jmespath-tests module.

Links


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@robin-aws robin-aws requested a review from a team as a code owner December 5, 2025 23:19
@robin-aws robin-aws changed the title Smithy jmespath evaluator JMESPath evaluation Dec 5, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2025

This pull request does not contain a staged changelog entry. To create one, use the ./.changes/new-change command. For example:

./.changes/new-change --pull-requests "#2878" --type feature --description "Smithy jmespath evaluator"

Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See ./.changes/README or run ./.changes/new-change -h for more information.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2025

This pull request does not contain a staged changelog entry. To create one, use the ./.changes/new-change command. For example:

./.changes/new-change --pull-requests "#2878" --type feature --description "JMESPath evaluation"

Make sure that the description is appropriate for a changelog entry and that the proper feature type is used. See ./.changes/README or run ./.changes/new-change -h for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant