From 27fc9b68585db3f00559107ff770397a8711fd23 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 20 Oct 2023 21:55:04 +0300 Subject: [PATCH 1/2] feature/update-respons-templating-transformer-doc updating code snippet and docs --- _docs/response-templating.md | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/_docs/response-templating.md b/_docs/response-templating.md index f7de71dc..06d908f1 100644 --- a/_docs/response-templating.md +++ b/_docs/response-templating.md @@ -903,22 +903,26 @@ Environment variables and system properties can be printed: {% endraw %} -To avoid disclosure of sensitive variables, only permitted variables can be read. Permitted variable names -are defined via a set of regular expressions. These can be configured when constructing the response template extension: +If you want to add permitted extensions to your rule, +then you can use the `ResponseTemplateTransformer` when constructing the response template extension. + +The `ResponseTemplateTransformer` accepts four arguments: +1. The `TemplateEngine` +2. If templating can be applied globally +3. The `FileSource` +4. A list of `TemplateModelDataProviderExtension` objects ```java @Rule public WireMockRule wm = new WireMockRule(options() .dynamicPort() .withRootDirectory(defaultTestFilesRoot()) - .extensions(new ResponseTemplateTransformer.Builder() - .global(true) - .permittedSystemKeys("allowed.*","also_permitted.*") - .build() + .extensions(new ResponseTemplateTransformer( + getTemplateEngine(), + options.getResponseTemplatingGlobal(), + getFiles(), + templateModelProviders + ) ) ); ``` - -The regular expressions are matched in a case-insensitive manner. - -If no permitted system key patterns are set, a single default of `wiremock.*` will be used. \ No newline at end of file From bf3477813a6b03a0297dbe54481a2af898b10306 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Oct 2023 17:10:37 +0300 Subject: [PATCH 2/2] feature/update-response-templating-transformer-doc adding information about filesource and last argument --- _docs/response-templating.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_docs/response-templating.md b/_docs/response-templating.md index 06d908f1..cf3635b4 100644 --- a/_docs/response-templating.md +++ b/_docs/response-templating.md @@ -909,8 +909,8 @@ then you can use the `ResponseTemplateTransformer` when constructing the respons The `ResponseTemplateTransformer` accepts four arguments: 1. The `TemplateEngine` 2. If templating can be applied globally -3. The `FileSource` -4. A list of `TemplateModelDataProviderExtension` objects +3. The `FileSource` which is a list of files that can be used for relative references in stub definitions +4. A list of `TemplateModelDataProviderExtension` objects which are additional metadata providers which will be injected into the model and consumed in the downstream resolution if needed ```java @Rule