Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.
This repository was archived by the owner on May 14, 2025. It is now read-only.

Execute OpenRewrite from Catalog #160

@fabapp2

Description

@fabapp2

Spike on a solution that allows users to execute recipes by name.
A new "Recipe Catalog" has mappings from the Recipe name to the recipe's artifact.
The Recipe Catalog also provides information about required and optional Recipe parameters.

Recipe Catalog

recipeCatalog:
  - recipeId: AddLicenseHeader
    artifactGav: org.openrewrite:rewrite-java:8.13.4
    recipeName: org.openrewrite.java.AddLicenseHeader
    description: Adds the provided licenseText as license header to all Java files.
    repositoryUrl: https://github.com/openrewrite/rewrite
    parameters:
      - name: licenseText
        type: String
        required: true

Providing Recipe Parameters

The mapping from command line arguments to Recipe parameters becomes quickly very complex.
For simple recipes with just String parameters like AddLicenseHeader that's not an issue.
But for more complex parameters, I'd change the API to expect parameters to be provided as JSON?

recipe byName <recipe-name> --parameters="{\"stringProperty\"=\"some string\", \"aList\"=[\"of\", \"strings\"]}"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions