Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please state defaults for optional parameters #248

Closed
koppor opened this issue Nov 20, 2023 · 4 comments
Closed

Please state defaults for optional parameters #248

koppor opened this issue Nov 20, 2023 · 4 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@koppor
Copy link

koppor commented Nov 20, 2023

GitHub actions make a good job explaining their parameters - and their default values.

Here, there is no list of default values.

Example: https://docs.openrewrite.org/recipes/java/logging/printstacktracetologerror.

I don't know if the Boolean default is true or false, what would be a really sensible value etc.

@koppor koppor added the enhancement New feature or request label Nov 20, 2023
@timtebeek timtebeek added the documentation Improvements or additions to documentation label Nov 20, 2023
@timtebeek
Copy link
Contributor

Agree that would be handy; the challenge is we don't set those defaults on the fields, so it's hard to have them available when we generate the documentation in rewrite-recipe-markdown-generator. In a case like this one the default can be found by clicking on the GitHub link, which shows it used further down. That's not optiomal of course, but figured that might help you for now.

@koppor
Copy link
Author

koppor commented Nov 20, 2023

@timtebeek
Copy link
Contributor

I should have picked another example - I cannot quickly see the default methodPattern of https://docs.openrewrite.org/recipes/java/logging/parameterizedlogging

No worries; on that one there is no default value, as all options are required unless they are specifically marked as required = false & @Nullable. You should see a validation error when you do not pass in a methodPattern.

@mike-solomon
Copy link
Contributor

Going to close this issue as I don't believe there is anything we can do to address this problem. I definitely understand the confusion -- but this is an underlying issue with how recipes are defined. Many recipes that have optional parameters do not have a "default" (as @timtebeek mentioned). For instance, an optional boolean is not really a "boolean" in the traditional sense. Not providing true or false could actually result in the recipe producing something different than providing it with true or false.

If there are particular recipes that you find confusing, I'd encourage you to submit a PR or open an issue in the GitHub repository where the recipe exists. We can update the descriptions of the parameters themselves to be clearer -- which would then carry over into the auto-generated docs.

You can find the GitHub repository for any recipe by navigating to the recipe page in the docs and pressing the GitHub link. For the parameterized logging recipe, that exists in the logging framework repository.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants