Skip to content

Use Jinja/Curly brackets inside YAML configs #74

@kingo55

Description

@kingo55

The modular builder could be more expressive if we used curly brackets to inject JS/CSS etc than if we hard-coded this logic into specific fields:

https://jinja.palletsprojects.com/en/2.11.x/templates/

It works quite well in Jinja, dbt, Home Assistant and other projects, so it might work well here too. Rather than:

state: staging
sampleRate: 0
id: w474
name: Some test name
css: shared.css
recipes:
  '0':
    name: Control
  '1':
    name: Treatment1
    js: 1.js
trigger: trigger.js

We could have something like:

state: staging
sampleRate: 0
id: w474
name: Some test name
css: {{ refCss('some-file.css') }}
recipes:
  '0':
    name: Control
  '1':
    name: Treatment1
    js: {{ ref('1.js') }}
trigger: {{ ref('trigger.js') }}

This would allow us to support new variable types (e.g. JSON) or fields as they come available e.g. custom functions passed into the option keys, like decisionAdapter, storageAdapter and whatnot.

This would change how we write all experiments' YAML files though, so perhaps we need to think this through properly and map out migration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions