Skip to content

Add HandlebarsSettings #1271

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

Merged
merged 8 commits into from
Apr 23, 2025
Merged

Add HandlebarsSettings #1271

merged 8 commits into from
Apr 23, 2025

Conversation

StefH
Copy link
Collaborator

@StefH StefH commented Apr 3, 2025

No description provided.

@StefH StefH added the feature label Apr 3, 2025
@StefH StefH self-assigned this Apr 3, 2025
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 58.53659% with 17 lines in your changes missing coverage. Please review.

Project coverage is 36.65%. Comparing base (a8562fd) to head (7c08783).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/WireMock.Net/Settings/SimpleSettingsParser.cs 57.69% 11 Missing ⚠️
...eMock.Net/Settings/WireMockServerSettingsParser.cs 50.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1271      +/-   ##
==========================================
+ Coverage   34.87%   36.65%   +1.78%     
==========================================
  Files         201      228      +27     
  Lines       33283    41690    +8407     
==========================================
+ Hits        11607    15281    +3674     
- Misses      21119    25731    +4612     
- Partials      557      678     +121     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@StefH StefH requested a review from Copilot April 3, 2025 10:16
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors and extends Handlebars integration by removing the old AllowedCustomHandlebarHelpers property and introducing a new HandlebarsSettings configuration.

  • Updated test cases to use the new HandlebarsSettings.
  • Refactored helper instantiation and settings parsing to support custom Handlebars helpers through HandlebarsSettings.
  • Adjusted documentation and minor spelling fixes in configuration files.

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs Replaced AllowedCustomHandlebarHelpers with HandlebarsSettings in test setup.
src/WireMock.Net/Transformers/Handlebars/WireMockHandlebarsHelpers.cs Updated helper initialization to access HandlebarsSettings.
src/WireMock.Net/Transformers/Handlebars/FileHelpers.cs Changed constructor signature to accept WireMockServerSettings.
src/WireMock.Net/Settings/WireMockServerSettingsParser.cs Removed the old settings and added parsing for HandlebarsSettings; note potential syntax issue with array literal.
src/WireMock.Net/Settings/* Updated and added HandlebarsSettings and associated enums.
README.md Updated documentation regarding changes to Handlebars helper configuration.
Files not reviewed (1)
  • src/WireMock.Net/WireMock.Net.csproj: Language not supported
Comments suppressed due to low confidence (1)

README.md:72

  • The README still refers to the old property name AllowedCustomHandlebarHelpers while the code now uses HandlebarsSettings. Please update the documentation to reflect the new configuration method.
To still enable this feature, you need to set the `AllowedCustomHandlebarHelpers` property to `File` in the `WireMockServerSettings` class.

@StefH StefH requested a review from Copilot April 3, 2025 17:08
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new HandlebarsSettings configuration to replace the legacy AllowedCustomHandlebarHelpers property for improved configurability and security. Key changes include updating tests and helper classes to use HandlebarsSettings, modifying configuration parsing logic, and updating documentation to reflect these changes.

Reviewed Changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/WireMock.Net.Tests/ResponseBuilders/ResponseWithHandlebarsFileTests.cs Updated test initialization to use HandlebarsSettings instead of the deprecated property.
src/WireMock.Net/Transformers/Handlebars/WireMockHandlebarsHelpers.cs Modified conditional check to reference HandlebarsSettings for custom helper permissions.
src/WireMock.Net/Transformers/Handlebars/FileHelpers.cs Changed constructor signature to accept WireMockServerSettings, aligning with new settings usage.
src/WireMock.Net/Settings/WireMockServerSettingsParser.cs Removed legacy property parsing and added ParseHandlebarsSettings for new configuration.
src/WireMock.Net/Settings/WireMockServerSettings.cs Removed the AllowedCustomHandlebarHelpers property and introduced HandlebarsSettings.
src/WireMock.Net/Settings/SimpleSettingsParser.cs Added support for ContainsAny and GetEnumValues for improved settings parsing.
ProxyUrlReplaceSettings.cs, ProxyAndRecordSettings.cs Minor spelling corrections in documentation comments.
src/WireMock.Net/Settings/HandlebarsSettings.cs Introduced the new HandlebarsSettings class with allowed helpers configuration.
src/WireMock.Net.Abstractions/Types/CustomHandlebarsHelpers.cs Renamed the enum to align with the new Handlebars configuration.
README.md Updated documentation to detail the breaking changes and new configuration method.
Files not reviewed (1)
  • src/WireMock.Net/WireMock.Net.csproj: Language not supported

@StefH StefH merged commit fc0f82d into master Apr 23, 2025
13 of 14 checks passed
@StefH StefH deleted the stef-HandlebarsSettings branch April 23, 2025 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant