{"id":37019165,"url":"https://github.com/derkork/simplegen","last_synced_at":"2026-01-14T02:03:42.631Z","repository":{"id":37270914,"uuid":"64370413","full_name":"derkork/simplegen","owner":"derkork","description":"A simple yet powerful general-purpose code generator","archived":false,"fork":false,"pushed_at":"2023-06-14T22:52:23.000Z","size":374,"stargazers_count":10,"open_issues_count":15,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T00:57:05.334Z","etag":null,"topics":["agnostic","code-generation","code-generator","json","language","toml","xml","yaml"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derkork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-28T06:39:49.000Z","updated_at":"2025-01-28T17:34:27.000Z","dependencies_parsed_at":"2023-01-29T22:01:03.101Z","dependency_job_id":null,"html_url":"https://github.com/derkork/simplegen","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/derkork/simplegen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derkork%2Fsimplegen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derkork%2Fsimplegen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derkork%2Fsimplegen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derkork%2Fsimplegen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derkork","download_url":"https://codeload.github.com/derkork/simplegen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derkork%2Fsimplegen/sbom","scorecard":{"id":335710,"data":{"date":"2025-08-11","repo":{"name":"github.com/derkork/simplegen","commit":"65e71f0e2769e6a915b92d4571d376bf30be47f5"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build-and-test.yaml:1","Warn: no topLevel permission defined: .github/workflows/release.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yaml:10: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/build-and-test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/build-and-test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build-and-test.yaml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/build-and-test.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/release.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/release.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/release.yaml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/derkork/simplegen/release.yaml/master?enable=pin","Info:   0 out of   7 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact simplegen-5.1.0 not signed: https://api.github.com/repos/derkork/simplegen/releases/86520603","Warn: release artifact simplegen-5.0.0 not signed: https://api.github.com/repos/derkork/simplegen/releases/84321175","Warn: release artifact simplegen-4.0.1 not signed: https://api.github.com/repos/derkork/simplegen/releases/84305322","Warn: release artifact simplegen-4.0.0 not signed: https://api.github.com/repos/derkork/simplegen/releases/84198065","Warn: release artifact simplegen-3.1.1 not signed: https://api.github.com/repos/derkork/simplegen/releases/81806811","Warn: release artifact simplegen-5.1.0 does not have provenance: https://api.github.com/repos/derkork/simplegen/releases/86520603","Warn: release artifact simplegen-5.0.0 does not have provenance: https://api.github.com/repos/derkork/simplegen/releases/84321175","Warn: release artifact simplegen-4.0.1 does not have provenance: https://api.github.com/repos/derkork/simplegen/releases/84305322","Warn: release artifact simplegen-4.0.0 does not have provenance: https://api.github.com/repos/derkork/simplegen/releases/84198065","Warn: release artifact simplegen-3.1.1 does not have provenance: https://api.github.com/repos/derkork/simplegen/releases/81806811"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"25 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-jjjh-jjxp-wpff","Warn: Project is vulnerable to: GHSA-rgv9-q543-rqg4","Warn: Project is vulnerable to: GHSA-3f7h-mf4q-vrm4","Warn: Project is vulnerable to: GHSA-5mg8-w23w-74h3","Warn: Project is vulnerable to: GHSA-7g45-4rm6-3mm3","Warn: Project is vulnerable to: GHSA-pfh2-hfmq-phg5","Warn: Project is vulnerable to: GHSA-wxr5-93ph-8wr9","Warn: Project is vulnerable to: GHSA-78wr-2p64-hpwj","Warn: Project is vulnerable to: GHSA-cgp8-4m63-fhh5","Warn: Project is vulnerable to: GHSA-493p-pfq6-5258","Warn: Project is vulnerable to: GHSA-v528-7hrm-frqp","Warn: Project is vulnerable to: GHSA-j288-q9x7-2f5v","Warn: Project is vulnerable to: GHSA-rhgr-952r-6p8q","Warn: Project is vulnerable to: GHSA-2f88-5hg8-9x2x","Warn: Project is vulnerable to: GHSA-3mc7-4q67-w48m","Warn: Project is vulnerable to: GHSA-98wm-3w3q-mw94","Warn: Project is vulnerable to: GHSA-9w3m-gqgf-c4p9","Warn: Project is vulnerable to: GHSA-c4r9-r8fh-9vj2","Warn: Project is vulnerable to: GHSA-hhhw-99gj-p3c3","Warn: Project is vulnerable to: GHSA-mjmj-j48q-9wg2","Warn: Project is vulnerable to: GHSA-w37g-rhq8-7m4j","Warn: Project is vulnerable to: GHSA-8vhq-qq4p-grq3","Warn: Project is vulnerable to: GHSA-g6ph-x5wf-g337","Warn: Project is vulnerable to: GHSA-jcwr-x25h-x5fh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T04:40:23.210Z","repository_id":37270914,"created_at":"2025-08-18T04:40:23.210Z","updated_at":"2025-08-18T04:40:23.210Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agnostic","code-generation","code-generator","json","language","toml","xml","yaml"],"created_at":"2026-01-14T02:03:42.085Z","updated_at":"2026-01-14T02:03:42.624Z","avatar_url":"https://github.com/derkork.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleGen -  A simple yet powerful general-purpose code generator\n\n![GitHub build status](https://img.shields.io/github/actions/workflow/status/derkork/simplegen/build-and-test.yaml?branch=master)\n![Maven Central](https://img.shields.io/maven-central/v/com.ancientlightstudios/simplegen)\n![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/derkork/simplegen)\n\nSimpleGen is a simple yet powerful general-purpose code generator. It is not specialized to any language,\nso whatever your target language is (may it be Java, Kotlin, C#, Ruby, JavaScript, HTML, CSS, etc.) - if it is text then \nthis generator should be able to create it. SimpleGen has been used successfully in several projects to help create \nrepetitive or boilerplate code. Some applications in which SimpleGen has been used are:\n\n- create JPA entity definitions\n- create reusable test data \n- create a JavaScript REST client\n- sanitize and filter OpenAPI specifications\n- generate a static documentation website\n- scraping data from HTML pages\n\n\n## How SimpleGen works\n\nSimpleGen takes data in various formats and runs this data through a Jinja2 template to generate output files:\n\n\n```ditaa\n    +------------+\n    |            +-+\n    |    Data    | |\n    |  (various  | | +----+\n    |  formats)  | |      |                            +------------+\n    +------------+ |      |     +-------------+        |            +-+\n      +------------+      +---\u003e |             |        |   Output   | +-+\n                                |  SimpleGen  +------\u003e |   (Text)   | | |\n                          +---\u003e |             |        |            | | |\n    +------------+        |     +-------------+        +------------+ | |\n    |            |        |                              +------------+ |\n    |  Template  | +------+                                +------------+\n    |  (Jinja2)  |\n    |            |\n    +------------+\n```\n\n\n\n## Requirements\n\n* Java 8 or later\n* _Optional_: Maven 3 if you'd like to use the maven plugin.\n\n## Usage\n\nThe generator can be used standalone or as a Maven plugin. In both cases it expects an input structure that looks like this:\n \n* ``config.yml`` - the configuration file\n* ``data.yml`` - a data file (optional, can also be in other formats, you can choose any name you like)\n* ``template.j2`` - at least one template\n\n## Running through the command line\nTo use the generator through the command line, [download the latest version](https://github.com/derkork/simplegen/releases/latest) from GitHub. Then you can invoke the code generator by running:\n\n```\njava -jar simplegen-bundle.jar \\\n  --sourceDirectory \u003cpath to input structure\u003e \\\n  --outputDirectory \u003cpath for generated files\u003e\n```\n\nThis will read the input structure from the input directory, generate the code and place the generated files in the output directory.  \n\n## Running with Maven\n\nSimply add the [Maven plugin](simplegen-maven-plugin/README.md) to your build plugins:\n\n```xml\n    \u003cbuild\u003e\n        \u003cplugins\u003e\n            ...\n            \u003cplugin\u003e\n                \u003cgroupId\u003ecom.ancientlightstudios\u003c/groupId\u003e\n                \u003cartifactId\u003esimplegen-maven-plugin\u003c/artifactId\u003e\n                \u003cversion\u003e\u003c!-- \n                     see badge at the top of the github \n                     page for the current release version \n            --\u003e\u003c/version\u003e\n                \u003cexecutions\u003e        \n                    \u003cexecution\u003e\n                        \u003cid\u003egenerate\u003c/id\u003e\n                        \u003cphase\u003egenerate-sources\u003c/phase\u003e\n                        \u003cgoals\u003e\n                            \u003cgoal\u003egenerate\u003c/goal\u003e\n                        \u003c/goals\u003e\n                    \u003c/execution\u003e\n                \u003c/executions\u003e\n            \u003c/plugin\u003e\n            ...\n        \u003c/plugins\u003e\n    \u003c/build\u003e\n```\n\nThe plugin expects the configuration files to reside in `src/main/simplegen` and will write its output to \n`target/generated-sources/simplegen`.\n\n#### Incremental generation\n\nSources are generated incrementally. This means that the generated files\nare only recreated when the input for them (e.g. templates, data, scripts) has changed. This avoids\nunnecessary re-compilation of generated code when the generated code hasn't actually changed.\n\nIf you want to re-generate all code no matter whether or not the input has changed, use the `--force`\ncommand line option or the `\u003cforceUpdate\u003etrue\u003c/forceUpdate\u003e` Maven setting.\n\n### Data\n\nThe data is a very important part of the workflow as it is the basis on which all templates are processed. Data is\nparsed from data files into a map-like tree structure. You can use multiple source files for your data. SimpleGen\nparses each file into a map-like tree structure and then merges all the trees into a single tree. This final tree\nis the input for your templates.\n\nData can be given in various formats, the default being YAML:\n\n```yaml\nsettings:\n  - name: fooCount\n    description: How much foo you need.\n    type: int\n    min: 1\n    max: 100\n\n  - name: barUrl\n    description: URL to the bar system.\n    type: String\n```\n\nAgain, the data file is totally free-form, you can structure it any way that fits your needs. There are no special keywords that the generator acts upon, it's just a structured data file that drives code generation with your templates. E.g. if you want to generate code for settings, put in some settings. If you want to generate a static website, put in your content, etc. \n\nIn addition to YAML the following data formats are supported:\n\n* [TOML](simplegen-dataformat-toml/README.md)\n* [XML](simplegen-dataformat-xml/README.md)\n* [CSV](simplegen-dataformat-csv/README.md)\n* [HTML](simplegen-dataformat-html/README.md)\n\n\nNow that we have the data in place, we can start working on the template.\n\n### Templates\n  \nThe templates control what output is produced. Templates are written in the Jinja2 template language. You can configure SimpleGen to run a template for a series of nodes in your YAML structure. In this example we configure SimpleGen to generate a settings Java class based on the settings we created in our YAML data and some documentation for the end user.  In these templates you will see two variables that are being used:\n\n* `node` - when you run SimpleGen you can configure that for each entry of a list in your data a copy of a certain template should be rendered. E.g. for our HTML example, we would generate a copy of this template for each setting in our `settings` list so every time the template is processed, `node` will contain the current entry in the list of settings.\n* `data` - this contains the whole merged data tree from all scanned data files. This can be useful if you have global information  that you want to share across templates or if you want to create a single file from all data that you have.\n\nYou can use every feature of the Jinja2 template language including macros, includes, etc. When you include things remember that all paths must be specified relative to the `config.yml` file. SimpleGen also defines some additional filters on top of the Jinja2 built-ins that are quite useful. See the _Advanced_ section below for details on these.\n\n```java\npackage com.example.settings;\n\npublic class ApplicationSettings {\n    \n    {#  Create the fields for the settings. #}\n    {% for setting in data.settings %}\n\n    {# We can create a Javadoc from the description. #}\n    /**\n     * {{setting.description}}\n     */\n    {# The field itself #}\n    private {{setting.type}} {{setting.name}};\n\n    {# a getter, we use the built-in case-filter to convert the settings name to a method name #}\n    public  {{ setting.type }} get{{ setting.name | case('lower-camel', 'upper-camel') }}() {\n        return this.{{setting.name}};\n    }\n\n    {# a setter #}\n    public void set{{ setting.name | case('lower-camel', 'upper-camel') }}({{ setting.type }} value) {\n        this.{{setting.name}} = value;\n    }\n    {% endfor %}\n}\n```\n\nThe template creates a java class with the defined settings each of them getting a field a getter and a setter. You could also generate code that reads settings from a file and validates them for the constraints given (e.g. required files, min and max size, etc.) but I left this out for clarity.\n\nNow in addition we would like to have some documentation for the settings. So for each setting we would like to create an HTML file with a description of the settings. In a real scenario you will probably have all in one file, but I want to show how you can use the same data to generate a single file and multiple files.\n\n```html\n\u003chtml\u003e\n\u003cbody\u003e\n\u003ch1\u003e{{node.name}}\u003c/h1\u003e\n{{node.description}}\n\nThis setting is of type \u003ccode\u003e{{ node.type }}\u003c/code\u003e.\n\u003c/body\u003e\n\u003c/html\u003e\n```\nThis is probably going to look very ugly, but I think it gets the point across.\n\n\n### Configuration\n\nNow that we have data and a template, the last remaining step is to tell SimpleGen how to process these. You do this inside the `config.yml` file. There you can define a series of transformations that SimpleGen should perform. Each transformation will read in data from one or more files and then apply this data to a template for a subset of the nodes from the parsed data: \n\n```yaml\n# You can have multiple transformations.\ntransformations:\n    # From where to pull the data. You can pull more than one file, in which case their contents get merged.\n    # Paths are relative to the config.yml file unless you specify an absolute path.\n  - data: \n      # Fetches data from data.yml\n      - data.yml\n      # Also ant style file selection is supported, this fetches data from all YAML files below the\n      # folder where config.yml is located (including config.yml)\n      - **/*.yml\n      # If you want more control you can specify includes and excludes.\n      # E.g. if you don't want to have config.yml as part of your data \n      # you can exclude it:\n      - includes: **/*.yml\n        excludes: config.yml\n        basePath: .\n      # It is usally a good practice to put your data files into a subfolder, so you \n      # don't need to exclude the config.yml.\n      - data/**/*.yml\n      # Starting from version 2.1.0 SimpleGen supports additional data formats. You can specify a mime type \n      # if you want to use a different format than yaml. If no mime type is specified, yaml is assumed.\n      - includes: **/*.toml\n        mimeType: application/toml\n      # you can also specify a prefix path under which the data file should be mounted in the data tree.\n      - includes: some_data.csv\n        mimeType: application/csv\n        # you can  now access the data from the csv file under data.my_data\n        resultPath: my_data\n      # Starting from version 3.0.0 SimpleGen also supports\n      # specifying data directly inline in the configuration\n      - inline:\n          # you can put arbitrary key-value pairs in here\n          foo: bar\n          baz: bam\n          # Arrays and nested structures are also supported\n          some_array:\n            - foo bar baz bam\n          deeper:\n            nested:\n              structure:\n                - is \n                - also \n                - possible\n      \n    # Which template should be used to render the data. Specify the path relative to the config.yml file.  \n    template: settings-class.java.j2\n\n    # For which nodes in the data should the template be executed. This is a JsonPath.\n    # Note how we use $ here, which means the root node. Since this is only a single node\n    # SimpleGen will only generate a single file in this transformation.\n    nodes: $\n    # What should be the output path of the generated file. \n    outputPath: \"com/example/settings/ApplicationSettings.java\"\n  \n  # Now a second transformation for generating the HTML files\n  - data: \n      - data.yml\n    # Use the HTML template to generate the HTML documentation.\n    template: documentation.html.j2\n    # Repeat this for each of the settings in our list.\n    nodes: $.settings\n    # Because we create one file for each setting, we need to have\n    # a unique file name for each generated output file. We can do this\n    # by using an expression in the output path. This uses\n    # node.name which is the name of the setting. \n    outputPath: \"docs/{{ node.name }}.html\"\n\n  - data:\n      - data.yaml\n    template: template.j2\n    # Starting with SimpleGen 5.1.0 you can now also use \n    # jinja2 expressions in the nodes selector. This gives\n    # you a lot more flexibility in how you select the nodes for processing.\n    nodes:\n      # take all strings in the \"settings\" array and prefix them\n      # with the string \"test-\"\n      expression: \"data.settings | prefix('test-')\"\n      type: jinja2\n    outputPath: \"settings/{{ node }}.html\"\n```\n\nYou can use expressions in all fields of the configuration. So e.g. if you want to pull data from a folder set by a system property you can do it like this:\n\n```yaml\n# Assuming you have set the system property 'input.path' to '/some/path'\n\ntransformations:\n  - data: \n      - includes: **/.yml\n        basePath: \"{{ 'input.path' | sp }}\"  # will set the basePath to /some/path\n```\nYou can also configure the template engine within `config.yml`. The template engine configuration is optional, if you leave it out, all values will be initialized with `false`. The configuration can be done globally or per transformation:\n\n```yaml\n# This is the global configuration. \ntemplateEngine:\n    # if true the first newline after a template tag is removed. default is false.\n    trimBlocks: true\n\n    # if true tabs and spaces from the beginning of a line to the start of a \n    # block are stripped. (Nothing will be stripped if there are other\n    # characters before the start of the block.). default is false.\n    lstripBlocks: true\n\n    # if true, macros are allowed to recursively call themselves. Be sure you\n    # end the recursion at some point otherwise you may crash\n    # with a stack overflow or just hang in an endless loop.\n    # default is false.\n    enableRecursiveMacroCalls: true\n\n    # if true, expressions that yield jinja template code will be re-interpreted\n    # until no more jinja template code is in them. Use with care.  \n    # default false\n    nestedInterpretationEnabled: true\n    \ntransformations:\n   - data: \n        - data.yml\n     ...\n     templateEngine:\n        # This is a configuration for this single transformation, only.\n        trimBlocks: false\n        lstripBlocks: false\n        enableRecursiveMacroCalls: false\n```\n### Advanced\n\nCongratulations, you've made it through the documentation! This section contains some additional information that you may not need in each and every project but that is useful in some circumstances. \n\n#### Additional built-in filters\n\nIn addition to the standard filters, this package adds a `jsonpath` filter to the template engine, so you can use JSONPath to effectively select interesting substructures of your data:\n\n```jinja2\n{# find all private fields of the class #}\n{% set private_fields = node | jsonpath(\"$.fields[?(@.visibility == 'private')]\") %}\n\n```\n\nSee the [JsonPath GitHub project](https://github.com/json-path/JsonPath) for a full documentation on how JsonPath works and what expressions you can use.\n\nIt is also possible to inject data through system properties using the `sp` filter:\n  \n```jinja2\n# Assuming you have set a system property with -DsomeProp=someValue\n{{ 'someProp' | sp }}  # will print someValue\n\n```\n\nSimilarly, you can access environment variables using the `env` filter. Note that these variables are dependent on the operating system, so your templates may not be portable when relying on environment variables:\n\n```jinja2\n# will print the path of the user's home directory on Linux/OSX\n{{ 'HOME' | env }}  \n```\n\n\nFinally a thing that is often required when generating code is case-changing of identifiers, so SimpleGen adds a custom filter for this as well. The syntax of this filter is:\n\n```jinja2\ncase( \u003cinput case\u003e, \u003coutput case\u003e )\n```\n\nSupported case formats are:\n\n* 'upper-camel' - FooBar\n* 'lower-camel' - fooBar\n* 'lower-hyphen' - foo-bar\n* 'upper-underscore' - FOO_BAR\n* 'lower-underscore' - foo_bar\n\n```jinja2\n{{ 'SomeString' | case('upper-camel', 'lower-hyphen') }} {# will print 'some-string' #}\n{{ 'someString' | case('lower-camel', 'upper-camel') }} {# will print 'SomeString' #}\n{{ 'some-string' | case('lower-hyphen', 'upper-camel') }} {# will print 'SomeString' #}\n\n```\n\n#### Custom filters\n\nIf you have specific needs for your project you can also write custom filters in JavaScript. A filter is simply a javascript function that receives objects and works on them. The functions will be executed inside the GraalVM scripting engine so you can use all of it's functionality (including full access to the Java API) in your scripts. \n\n```javascript\n// a simple filter which multiplies the input\nfunction times(input, resolve, arguments) {\n    return input * arguments[0];\n}\n```\n\nThe three arguments of the function are:\n* `input` - the object to filter\n* `resolve` - a function that can be used to resolve template variables. See below for an example.\n* `arguments` - the arguments given to the filter in the template (an array of strings)\n\nYou can access the template context in your custom filter. This is useful, if you would like to get access to some data in the `data` or `node` variables.\n\n```javascript\n// a simple filter which reads some value from the template context\nfunction times(input, resolve, arguments) {\n    var data = resolve('data');\n    var node = resolve('node');\n\n    // now do something useful with it.\n}\n```\n\nTo register your custom filter, add the following to your `config.yml`:\n\n```yaml\ncustomFilters:\n   # Path to the script file containing the filter function, relative to config.yml\n - script: filters/myFilter.js\n   # Name of the filter function. This is also the name that will be used for the filter inside the template engine.\n   function: times\n\n - script: filters/moreFilters.js\n   function:\n    # You can also reference more than one function in the same file.\n    - myOtherFilter\n    - yetAnotherFilter\n\n # more custom filters..\n\n```\n  \nThen you can use your filter inside your templates like this:\n\n```jinja2\n{{ 5 | times(2) }} {# prints 10 #}\n```\n   \nYou can find a larger example in [simplegen-maven-example!](simplegen-maven-example/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderkork%2Fsimplegen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderkork%2Fsimplegen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderkork%2Fsimplegen/lists"}