Skip to content

Context Data Update Behavior #867

Closed
Closed
@matthias-pichler

Description

@matthias-pichler

What would you like to be added:

The output.to field allows to write data to the context. Is the context merged or overwritten by the data produced by this expression?

given a context of

{
  "foo": "bar"
}

will the expression

output:
  to: '{a: 1}'

result in

{
  "foo": "bar",
  "a": 1
}

or

{
  "a": 1
}

Personally always extending makes sense to me from a usability perspective but it seems to me that context could really explode in size this way. Especially because jq has built in methods for extending objects, such as

output:
  to: '.a = 1'

or

output:
  to: '$context + { a: 1 }'

which both are more explicit about extending

Why is this needed:

This is relevant for making sure data flow is implemented correctly and context does not explode in size.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: specChanges in the Specificationchange: documentationImprovements or additions to documentation. It won't impact a version change.change: featureNew feature or request. Impacts in a minor version change

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions