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

Inja bump from 2.1 -> 3.4 #247

Closed
3 tasks
jbohanon opened this issue Jun 14, 2023 · 0 comments
Closed
3 tasks

Inja bump from 2.1 -> 3.4 #247

jbohanon opened this issue Jun 14, 2023 · 0 comments

Comments

@jbohanon
Copy link
Contributor

jbohanon commented Jun 14, 2023

The following is a curated enumeration of the functional changes to the Inja library as we consume it when upgrading from v2.1 to v3.4. This is to track the work required to support solo-io/gloo#8177

2.2

  • ✔️ [CHANGE] Environment() constructor changed to use empty string instead of "./". link
    • ensure we aren't calling naked Environment() anywhere
    • this change was reverted in 3.4
  • [FEATURE] added at function to access elements in an array by index link
    • index out of range?
  • ✔️ [CHANGE] Environment's load_json will throw exception if file not found link
    • trace codepaths that use this and ensure we aren't using any
  • [FEATURE] add whitespace control options trim_blocks and lstrip_block link jinja reference
  • [FEATURE] a template can be included inside a loop, retaining the parent context link
  • ✔️ [CHANGE] Environment's Impl class removed link
    • ensure we aren't using this piece of Environment

3.0

  • ✔️ [CHANGE] Reworked exception throwing link
    • ensure we're not relying on the format of exceptions thrown out of inja; update accordingly
  • [FEATURE] Loop features index, index1, is_first, is_last can be used when looping over objects (maps) link
  • [PERFORMANCE] Improved performance when looping over large datasets link
  • ✔️ [CHANGE] removal of polyfill; not sure what was being polyfilled link
    • ensure we build without this
  • [FEATURE] disable searching for templates on file system link
    • New field in ParserConfig
    • Expose or explicitly enable depending on how we currently allow template configuration
  • [FEATURE] disable throwing an exception if included template not found link
    • New struct RenderConfig
    • Expose?
    • Test envoy behavior with/without setting with missing include
  • [FEATURE] add fine-grained whitespace control for statements e.g. {%+, {%-, -%} link
  • ✔️ [CHANGE] Node constructor signatures all changed to require size_t argument link
    • ensure we are not calling this constructor anywhere
  • ✔️ [CHANGE] Major rewrite of core (AKA the big one) link
    • Parser constructor now take 4 args instead of 3
      • 4th argument function_storage...
    • Pointer element notation removed from Parser config JSON Pointer RFC
      • test Envoy behavior if templates use pointer notation
      • explore possibly translating JSON pointers as a stopgap
  • [FEATURE] Plus, minus, times, slash, percent, power tokens added
    • test these operations for common errors, validate envoy behavior if failure
      • e.g. divide by zero, operations on NaN tokens
  • ✔️ [CHANGE] Numerous methods in Parser and Renderer made private link
    • ensure we build with this
  • [FEATURE] exists operation extended to be able to safely chain json pointers link
    • e.g. exists("array.1.name") can be used instead of the multiple calls exists("array"), existsIn("1", array), and existsIn("name", array.1)
  • [FEATURE] AtId operation added to access specific elements in a list of objects link
  • [PERFORMANCE] strings are no longer copied around needlessly link

3.1

  • [FEATURE] Add set statement to mutate data link
    • verify this only affects current scope and all child scopes; not parent scope
  • ✔️ [CHANGE] numerous values changed to const link
    • verify we build with this
  • [FEATURE] Add void callback link
    • we could use for logging or mutating dynamic metadata or modifying stats
  • [FEATURE] add fine-grained whitespace control for expressions e.g. {{%-, -%}} link
  • [FEATURE] consume UTF-8 byte order mark (BOM) link
    • this will not affect us

3.2

  • [FEATURE] Allow variables starting with @ and $ link
  • [FEATURE] Inja can be configured to abort instead of throw link

3.3

  • [CHANGE] short-circuit evaluation link
  • [FEATURE] inheritance between templates link
    • we should add extensive testing around this in case users build mega-templates with multiple levels of inheritence
  • [FEATURE] set statements can access child data via dot notation (not pointer notation as the docs state) link
  • [FEATURE] add fine-grained whitespace control for comments e.g. {#-, -#} link
  • [FEATURE] at can be nested to dynamically access object fields link
    • see test case for usage
  • [FEATURE] join function added to join lists with a separator link

3.4

  • [FEATURE] include callback link
    • this should be of limited use to us since we do not include from filesystem
  • ✔️ [CHANGE] Environment fields input_path and output_path changed from Public to Protected link
    • ensure we build with this
  • ✔️ [CHANGE] Environment() constructor changed to use "./" instead of empty string link
    • this is a reversion of a change in 2.2, no action should be required
  • [CHANGE] passing too few arguments to a function throws a parser error link
    • test envoy behavior when this error is thrown

Tasks

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

No branches or pull requests

1 participant