openrewrite / openrewrite/rewrite
Does not group Yaml properties correctly
Open
Nobody has claimed this yet.
bug
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the rewrite.yml recipe and reproduce the issue using the Maven plugin command shown, comparing the actual YAML with the expected output. Trace how the ChangePropertyKey recipe handles the nested YAML properties and verify the result against the supplied examples; done means the renamed properties retain the expected grouping and indentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, yaml
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100