Skip to content

AddProperty: add beforeProperty and afterProperty options#7251

Closed
bmuschko wants to merge 1 commit intomainfrom
bmuschko/scala-vararg-splat
Closed

AddProperty: add beforeProperty and afterProperty options#7251
bmuschko wants to merge 1 commit intomainfrom
bmuschko/scala-vararg-splat

Conversation

@bmuschko
Copy link
Copy Markdown
Contributor

@bmuschko bmuschko commented Apr 2, 2026

Summary

  • Adds two new mutually exclusive options (beforeProperty, afterProperty) to the AddProperty recipe, allowing insertion of a new property before or after a specific existing property key
  • Takes precedence over orderedInsertion; falls back to default behavior if the reference key is not found
  • Inserts before preceding comment blocks when using beforeProperty

Allow inserting a new property before or after a specific existing
property key, with fallback to default behavior when the reference
key is not found. Mutually exclusive options validated at recipe level.

Closes moderneinc/customer-requests#2156
@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Apr 2, 2026
@bmuschko bmuschko added the enhancement New feature or request label Apr 2, 2026
@bmuschko bmuschko requested a review from timtebeek April 2, 2026 16:08
@sambsnyd
Copy link
Copy Markdown
Member

sambsnyd commented Apr 3, 2026

I set this up to match how we do it for MergeYaml:
#7275

@bmuschko
Copy link
Copy Markdown
Contributor Author

bmuschko commented Apr 3, 2026

Closing my PR.

@bmuschko bmuschko closed this Apr 3, 2026
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants