Skip to content

Does not group Yaml properties correctly #4802

Open
@diegosilval

Description

What version of OpenRewrite are you using?

I am using

  • rewrite-maven-plugin v5.47.0
  • Maven v 3.9.9
  • rewrite-spring v5.25.0

How are you running OpenRewrite?

I am using the Maven plugin from command line.

mvn -U org.openrewrite.maven:rewrite-maven-plugin:run  \
  -Drewrite.activeRecipes=com.sample.MyYamlRecipe \
  -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:LATEST

And rewrite.yml

---
type: specs.openrewrite.org/v1beta/recipe
name: com.sample.MyYamlRecipe
recipeList:
  - org.openrewrite.yaml.ChangePropertyKey:
      oldPropertyKey: "app.rhino"
      newPropertyKey: "rhino"
  - org.openrewrite.yaml.ChangePropertyKey:
      oldPropertyKey: "app.security.header"
      newPropertyKey: "rhino.security.header"

What is the smallest, simplest way to reproduce the problem?

app:
  security:
    header:
      enabled: false
  rhino:
    config:
      props:
        - prop: 'name1'
          config[0]:
            prop1: 1
            prop2: 2
        -
          prop: 'name2'
          config[0]:
            prop1: 3
            prop2: 4

What did you expect to see?

rhino:
  security:
    header:
      enabled: false
  config:
    props:
      - prop: 'name1'
        config[0]:
          prop1: 1
          prop2: 2
      -
        prop: 'name2'
        config[0]:
          prop1: 3
          prop2: 4

What did you see instead?

rhino:
  config:
    props:
      - prop: 'name1'
        config[0]:
          prop1: 1
          prop2: 2
      -
                            prop: 'name2'
                            config[0]:
                              prop1: 3
                              prop2: 4
rhino.security.header:
  enabled: false

Activity

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

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    • Status

      No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions