openrewrite / openrewrite/rewrite

`@Option` should probably have `defaultValue` attribute

Open
#2,495 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

In addition to the example attribute it would probably make sense to also have a defaultValue attribute for the @Option annotation. One use case would be for boolean-types properties, where the default is documented to be true. Example: https://github.com/openrewrite/rewrite/blob/52da683b518791943685e2c0bedabbfb0bac5771/rewrite-yaml/src/main/java/org/openrewrite/yaml/DeleteProperty.java#L51-L57

In the SaaS UI the checkbox is rendered unticked (i.e. false) even though the description mentions that the default is true so in the end it isn't even quite clear to the user what it means for the checkbox to be unticked.

image

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

Start with the @Option annotation definition and the referenced DeleteProperty.java example, then trace how option metadata reaches the SaaS UI. Define what defaultValue should represent for boolean options and verify that the UI uses it when rendering the checkbox; the issue is done when documented true defaults are unambiguous there.

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.