← All recipes
Open source

Append to sequence

Recipe IDorg.openrewrite.yaml.AppendToSequence
Artifactorg.openrewrite:rewrite-yaml

Append item to YAML sequence.

Single recipeApache 2.0

Usage

You’ll need the Moderne CLI configured before running the command below.

mod run . --recipe org.openrewrite.yaml.AppendToSequence --recipe-option "sequencePath=$.universe.planets" --recipe-option "value=earth"

If the recipe isn’t available locally, install it with:

mod config recipes jar install org.openrewrite:rewrite-yaml:8.88.0

Options

NameTypeDescription
sequencePathrequiredStringA JsonPath expression to locate a YAML sequence.
e.g. $.universe.planets
valuerequiredStringThe new value to be appended to the sequence.
e.g. earth
existingSequenceValuesListIf specified, the item will only be appended if the existing sequence matches these values.
e.g. existingValue1
matchExistingSequenceValuesInAnyOrderBooleanIf specified in combination with the above parameter, the item will only be appended if the existing sequence has the specified values in any order.
e.g. true

Data tables

Structured output this recipe can produce.

  • Source files that had resultsSource files that were modified by the recipe run.org.openrewrite.table.SourcesFileResults
  • Source files that had search resultsSearch results that were found during the recipe run.org.openrewrite.table.SearchResults
  • Source files that errored on a recipeThe details of all errors produced by a recipe run.org.openrewrite.table.SourcesFileErrors
  • Recipe performanceStatistics used in analyzing the performance of recipes.org.openrewrite.table.RecipeRunStats