openrewrite / openrewrite/rewrite-spring

Remove duplicate keys in yaml

Open
#210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

recipe
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

In Yaml, a key may contain . like a.b.c:true.
In Spring, the values are resolved like properties so multiple values may be mapped to a single configuration property.

--- 
a: 
  b: 
    c: true
  b.c: ~
a.b: 
  c: false

@sanagaraj-pivotal requested a recipe to remove the duplicate keys
that prioritizes the last matched value.

Example
Choose 8080:

server.port: 9999
server:
  port: 8080

Choose 9999:

server:
  port: 8080
server.port: 9999

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file, test, or entry point is named in the issue. Start by locating the existing YAML recipe conventions and tests in rewrite-spring, then use the two ordering examples as acceptance cases: the last matching value should remain.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.