-
Notifications
You must be signed in to change notification settings - Fork 53
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
Issue with Precondition documentation generation #250
Comments
openrewrite/rewrite-recipe-markdown-generator@0fd23e6
Thanks for pointing this out! You've found a neat implementation detail around how we handle preconditions in declarative recipes; the message you saw originates here. Since the class is package private the best I could do for now is recognize such recipes by their message, and then skip them. |
So the issue here is that the bellwether is shown on the Yaml tab: That's an implementation detail; not something for folks to implement. Might mean we need to move this to There it shows up in the yaml tab as type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
recipeList:
- org.openrewrite.config.DeclarativeRecipe$PreconditionBellwether
- org.openrewrite.java.spring.AddSpringProperty |
Compare that to how the recipe is actually implemented: type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
preconditions:
- org.openrewrite.java.search.HasJavaVersion:
version: 21.X
recipeList:
- org.openrewrite.java.spring.AddSpringProperty:
property: spring.threads.virtual.enabled
value: true |
Related to issue: openrewrite/rewrite-docs#250
Related to issue: openrewrite/rewrite-docs#250 Co-authored-by: Mike Solomon <[email protected]>
As discussed on the above PR: it would be better to show the configured precondition & recipe arguments in the bellwether. So right now what we show is: CurrentNo bellwether (good), type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
recipeList:
- org.openrewrite.java.spring.AddSpringProperty IdealAs per the source type: specs.openrewrite.org/v1beta/recipe
name: org.openrewrite.java.spring.boot3.EnableVirtualThreads
displayName: Enable Virtual Threads on Java 21
description: Set `spring.threads.virtual.enabled` to `true` in `application.properties` or `application.yml`.
preconditions:
- org.openrewrite.java.search.HasJavaVersion:
version: 21.X
recipeList:
- org.openrewrite.java.spring.AddSpringProperty:
property: spring.threads.virtual.enabled
value: true |
As mentioned in this issue, I believe that changes will need to be made in rewrite itself (specifically RecipeDescriptor) to allow for Preconditions to be made available to the docs. |
For recipes such as https://docs.openrewrite.org/recipes/java/spring/boot3/enablevirtualthreads which contain a precondition (in this case
org.openrewrite.java.search.HasJavaVersion
the recipe list showsPrecondition bellwether
which links to https://github.com/openrewrite/rewrite-docs/blob/master/reference/recipes/config/declarativerecipe$preconditionbellwether.md rather than the expected HasJavaVersion recipe + link.The text was updated successfully, but these errors were encountered: