{"id":37911017,"url":"https://github.com/mindprogenitor/wiremock-freemarker-extension","last_synced_at":"2026-01-16T17:19:34.843Z","repository":{"id":30958737,"uuid":"125181692","full_name":"mindprogenitor/wiremock-freemarker-extension","owner":"mindprogenitor","description":null,"archived":false,"fork":false,"pushed_at":"2022-11-16T08:31:36.000Z","size":109,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-10T16:53:37.768Z","etag":null,"topics":["freemarker-template","stub","stub-body","wiremock","wiremock-server"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mindprogenitor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-14T08:42:21.000Z","updated_at":"2023-05-26T01:42:03.000Z","dependencies_parsed_at":"2022-07-15T19:49:00.854Z","dependency_job_id":null,"html_url":"https://github.com/mindprogenitor/wiremock-freemarker-extension","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mindprogenitor/wiremock-freemarker-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindprogenitor%2Fwiremock-freemarker-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindprogenitor%2Fwiremock-freemarker-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindprogenitor%2Fwiremock-freemarker-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindprogenitor%2Fwiremock-freemarker-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mindprogenitor","download_url":"https://codeload.github.com/mindprogenitor/wiremock-freemarker-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mindprogenitor%2Fwiremock-freemarker-extension/sbom","scorecard":{"id":647866,"data":{"date":"2025-08-11","repo":{"name":"github.com/mindprogenitor/wiremock-freemarker-extension","commit":"747dcad49e1be58381d757a623b2b1fb7236bec4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.5,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/27 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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact 0.0.2 not signed: https://api.github.com/repos/mindprogenitor/wiremock-freemarker-extension/releases/10231454","Warn: release artifact 0.0.1 not signed: https://api.github.com/repos/mindprogenitor/wiremock-freemarker-extension/releases/10123889","Warn: release artifact 0.0.2 does not have provenance: https://api.github.com/repos/mindprogenitor/wiremock-freemarker-extension/releases/10231454","Warn: release artifact 0.0.1 does not have provenance: https://api.github.com/repos/mindprogenitor/wiremock-freemarker-extension/releases/10123889"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 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":"55 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-h46c-h94j-95f3","Warn: Project is vulnerable to: GHSA-wf8f-6423-gfxg","Warn: Project is vulnerable to: GHSA-288c-cq4h-88gq","Warn: Project is vulnerable to: GHSA-4gq5-ch57-c2mg","Warn: Project is vulnerable to: GHSA-4w82-r329-3q67","Warn: Project is vulnerable to: GHSA-57j2-w4cx-62h2","Warn: Project is vulnerable to: GHSA-5949-rw7g-wx7w","Warn: Project is vulnerable to: GHSA-5r5r-6hpj-8gg9","Warn: Project is vulnerable to: GHSA-5ww9-j83m-q7qx","Warn: Project is vulnerable to: GHSA-645p-88qh-w398","Warn: Project is vulnerable to: GHSA-6fpp-rgj9-8rwc","Warn: Project is vulnerable to: GHSA-6wqp-v4v6-c87c","Warn: Project is vulnerable to: GHSA-85cw-hj65-qqv9","Warn: Project is vulnerable to: GHSA-89qr-369f-5m5x","Warn: Project is vulnerable to: GHSA-8c4j-34r4-xr8g","Warn: Project is vulnerable to: GHSA-8w26-6f25-cm9x","Warn: Project is vulnerable to: GHSA-9gph-22xh-8x98","Warn: Project is vulnerable to: GHSA-9m6f-7xcq-8vf8","Warn: Project is vulnerable to: GHSA-9mxf-g3x6-wv74","Warn: Project is vulnerable to: GHSA-c8hm-7hpq-7jhg","Warn: Project is vulnerable to: GHSA-cf6r-3wgc-h863","Warn: Project is vulnerable to: GHSA-cggj-fvv3-cqwv","Warn: Project is vulnerable to: GHSA-cjjf-94ff-43w7","Warn: Project is vulnerable to: GHSA-cmfg-87vq-g5g4","Warn: Project is vulnerable to: GHSA-cvm9-fjm9-3572","Warn: Project is vulnerable to: GHSA-f3j5-rmmp-3fc5","Warn: Project is vulnerable to: GHSA-f9hv-mg5h-xcw9","Warn: Project is vulnerable to: GHSA-f9xh-2qgp-cq57","Warn: Project is vulnerable to: GHSA-fmmc-742q-jg75","Warn: Project is vulnerable to: GHSA-fqwf-pjwf-7vqv","Warn: Project is vulnerable to: GHSA-gjmw-vf9h-g25v","Warn: Project is vulnerable to: GHSA-gwp4-hfv6-p7hw","Warn: Project is vulnerable to: GHSA-gww7-p5w4-wrfv","Warn: Project is vulnerable to: GHSA-h3cw-g4mq-c5x2","Warn: Project is vulnerable to: GHSA-h592-38cm-4ggp","Warn: Project is vulnerable to: GHSA-h822-r4r5-v8jg","Warn: Project is vulnerable to: GHSA-jjjh-jjxp-wpff","Warn: Project is vulnerable to: GHSA-m6x4-97wx-4q27","Warn: Project is vulnerable to: GHSA-mph4-vhrx-mv67","Warn: Project is vulnerable to: GHSA-mx7p-6679-8g3q","Warn: Project is vulnerable to: GHSA-mx9v-gmh4-mgqw","Warn: Project is vulnerable to: GHSA-p43x-xfjf-5jhr","Warn: Project is vulnerable to: GHSA-q93h-jc49-78gg","Warn: Project is vulnerable to: GHSA-qjw2-hr98-qgfh","Warn: Project is vulnerable to: GHSA-qr7j-h6gg-jmgc","Warn: Project is vulnerable to: GHSA-r3gr-cxrf-hg25","Warn: Project is vulnerable to: GHSA-r695-7vr9-jgc2","Warn: Project is vulnerable to: GHSA-rfx6-vp9g-rh7v","Warn: Project is vulnerable to: GHSA-rgv9-q543-rqg4","Warn: Project is vulnerable to: GHSA-rpr3-cw39-3pxh","Warn: Project is vulnerable to: GHSA-v585-23hc-c647","Warn: Project is vulnerable to: GHSA-vfqx-33qm-g869","Warn: Project is vulnerable to: GHSA-w3f4-3q6j-rh82","Warn: Project is vulnerable to: GHSA-wh8g-3j2c-rqj5","Warn: Project is vulnerable to: GHSA-x2w5-5m2g-7h5m"],"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-21T12:38:14.017Z","repository_id":30958737,"created_at":"2025-08-21T12:38:14.017Z","updated_at":"2025-08-21T12:38:14.017Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["freemarker-template","stub","stub-body","wiremock","wiremock-server"],"created_at":"2026-01-16T17:19:34.786Z","updated_at":"2026-01-16T17:19:34.836Z","avatar_url":"https://github.com/mindprogenitor.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wiremock-freemarker-extension\n\nWiremock Freemarker Extension is a [Wiremock](https://www.wiremock.org) extension that allows the use of the [Freemarker](https://freemarker.apache.org) template engine by using the stub body as a freemarker template and making the request available to be used in the template as variables (if the request is either a valid xml or json object, it will be parsed and the values may be referenced directly in the template).\n\n# NOTICE:\n\nThis extension was created initially for wiremock version 2.4.1 when it wasn't distributed with any response template mechanism (A similar extension was developed then under a proprietary license and recreated independently for open source maintenance). Handlebars was added to wiremock version 2.5, and this library was updated to continue using stubs that had already been created to use with freemarker.\n\nMaintenance of this library is now limited as wiremock now provides a template mechanism out of the box.\n\n## How to set it up\nWiremock can run both as a standalone mock server or as a unit test server instance, as explained in the [Wiremock documentation](https://www.wiremock.org/docs). \n\nIn order to make the extension available for stub creation, the extension needs both to be available in the wiremock server classpath as well as having the server configured to be aware of the extension. Please refer to the official documentation for a more complete overview of how to use wiremock with extensions.\n\n* **For Unit Tests**\n\n  You need to include the wiremock freemarker extension as dependency of your project.\n  \n  Example dependencies in the pom.xml of a maven project\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.tomakehurst\u003c/groupId\u003e`\n      \u003cartifactId\u003ewiremock\u003c/artifactId\u003e\n      \u003cversion\u003e2.14.0\u003c/version\u003e\n      \u003cscope\u003etest\u003c/scope\u003e\n  \u003c/dependency\u003e\n  \u003cdependency\u003e\n      \u003cgroupId\u003ecom.mindprogeny.wiremock.extension\u003c/groupId\u003e\n      \u003cartifactId\u003ewiremock-freemarker-extension\u003c/artifactId\u003e\n      \u003cversion\u003e0.0.1\u003c/version\u003e\n      \u003cscope\u003etest\u003c/scope\u003e\n  \u003c/dependency\u003e\n  ``` \n  The extension was mainly developed for the standalone version of wiremock and as such includes all libraries required to run it on the standalone. The wiremock library includes some jackson libraries which are not available in the standalone version (since all dependencies are bundled in the same jar and the library packages are renamed to avoid conflicts), as such, using more recent versions of wiremock can potentially cause conflicts in dependencies. Check for dependency conflicts and solve them.\n\n  To start up a Wiremock Server using a JUnit rule:\n  ```java\n             .\n             .  \n  import org.junit.Rule;\n  import com.github.tomakehurst.wiremock.core.WireMockConfiguration;\n  import com.github.tomakehurst.wiremock.junit.WireMockRule;\n  import com.mindprogeny.wiremock.extension.freemarker.FreemarkerResponseTransformer;\n             .\n             .\n\n  @Rule\n  public WireMockRule wiremock = \n         new WireMockRule(WireMockConfiguration.wireMockConfig()\n                                               .port(55080)\n                                               .extensions(new FreemarkerResponseTransformer()));\n  ```\n  Where 55080 would be the port where the wiremock server would be listening.\n\n* **For Standalone Wiremock**\n\n  Download the standalone wiremock server (as explained in the [Wiremock documentation](https://www.wiremock.org/docs/running-standalone)) and the [wiremock freemarker extension](https://github.com/mindprogenitor/wiremock-freemarker-extension/releases).\n \n  Run wiremock using the following minimal command (feel free to add any additional wiremock specific flags you need):\n  ```sh\n  java -cp \"wiremock-standalone-2.14.0.jar:wiremock-freemarker-extension-0.0.2.jar\" \\\n       com.github.tomakehurst.wiremock.standalone.WireMockServerRunner \\\n       --port 8080 --https-port 8443 \\\n       --extensions com.mindprogeny.wiremock.extension.freemarker.FreemarkerResponseTransformer\n  ```\n  \n## How to use it\n\nYou may use wiremock as normal, except that you may define the body of your stub as a freemarker template, associate the stub with the freemarker extension and the extension will transform the stub body with freemarker before returning it to the requesting agent.\n\nFor example:\n```java\nwiremock.stubFor(get(urlEqualTo(\"/test\"))\n        .willReturn(aResponse().withStatus(200)\n                               .withHeader(\"content-type\", \"application/xml\")\n                               .withBody(\"\u003croot\u003e\u003cdate\u003e${.now}\u003c/date\u003e\u003c/root\u003e\")\n                               .withTransformers(\"freemarker-transformer\")));\n```\nOr through the REST API:\n```json\n{\n  \"request\": {\n    \"url\": \"/test\",\n    \"method\": \"GET\" },\n  \"response\": {\n    \"status\": 200,\n    \"body\": \"\u003croot\u003e\u003cdate\u003e${.now}\u003c/date\u003e\u003c/root\u003e\",\n    \"headers\": {\n    \"Content-Type\": \"application/xml\" },\n    \"transformers\": [\"freemarker-transformer\"] }\n}\n```\nCalls to endpoints configured with the extension will take the following steps:\n\n![Freemarker Extension Processing flow](doc/image/flow.png \"Flow\") \n\n1. Request for `/test` is received\n2. Wiremock finds configured matching stub and identifies it as using the freemarker transformer.\n3. The extension is called with the stubbed response as well as the received request\n4. Extension parses the request and creates a request object to be used as a variable in the freemarker template.\n5. Freemarker template is called using the stub body as the template and the request object as a variable.\n6. Extension returns processed template as the response body.\n7. Wiremock returns response to calling agent.\n\nIn this simple example, regardless of the request contents, the response is a simple xml object with a date tag containing the timestamp of the response generation.\n\n## The Request Object\n\nThe request is processed by the extension and transformed into a map which is made available to the template.\n\nThe Request Object has the following format:\n\n```\n.-\u003e request\n|     |-\u003e body                     - The original request body. May be null if request has no content.\n|     |-\u003e url                      - The endpoint, with parameters, used to access the stub\n|     |-\u003e cookies                  - attribute containing all cookies received. May be null if no cookies.\n|     |     |-\u003e \u003ccookie name_1\u003e    - Each cookie value can be directly accessed by name\n|     |     |-\u003e \u003ccookie name_2\u003e\n|     |     |       ..\n|     |     \\-\u003e \u003ccookie name_n\u003e\n|     \\-\u003e parameters               - Query parameters received. May be null if no query parameters present.\n|           |-\u003e \u003cparameter name_1\u003e - Each query parameter value can be accessed directly by name\n|           |-\u003e \u003cparameter name_2\u003e\n|           |       ..\n|           \\-\u003e \u003cparameter name_n\u003e\n|\n|   If the request body is either an xml or a json object, the request object is filled with additional map entries\n|   taking values from the xml or json objects.\n|\n|-\u003e \u003crequest attribute/tag\u003e\n|-\u003e \u003crequest attribute/tag\u003e\n|       ..\n\\-\u003e \u003crequest attribute/tag\u003e\n```\n\nThe variable structure made available in the request object is dependent on the kind of object present in the request.\n\nRefer to the [Request Object Documentation](doc/RequestObject.md) for more information.\n\n## Using Variables for dynamic stubbing\n\nThe Extension also allows you to create variable sets which can be used in templates allowing for dynamic stub generation (using part of the request to choose a set of variables to use) or simplified templates (for example, using loops to generate repetitive blocks).\n\nRefer to the [dynamic templates documentation](doc/DynamicTemplates.md) for additional information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindprogenitor%2Fwiremock-freemarker-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmindprogenitor%2Fwiremock-freemarker-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmindprogenitor%2Fwiremock-freemarker-extension/lists"}