Skip to content

Commit

Permalink
Update Scriban.Signed to version 5.5.0 (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH committed Jul 29, 2022
1 parent 968aa59 commit ae91ed2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 17 deletions.
16 changes: 15 additions & 1 deletion src/WireMock.Net/Transformers/Scriban/WireMockListAccessor.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Scriban;
using Scriban.Parsing;
Expand Down Expand Up @@ -50,6 +50,20 @@ public bool TrySetValue(TemplateContext context, SourceSpan span, object target,
{
throw new NotImplementedException();
}

public bool TryGetItem(TemplateContext context, SourceSpan span, object target, object index, out object value)
{
throw new NotImplementedException();
}

public bool TrySetItem(TemplateContext context, SourceSpan span, object target, object index, object value)
{
throw new NotImplementedException();
}

public bool HasIndexer => throw new NotImplementedException();

public Type IndexType => throw new NotImplementedException();
#endregion
}
}
20 changes: 8 additions & 12 deletions src/WireMock.Net/Transformers/Scriban/WireMockTemplateContext.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
using Scriban;
using Scriban;
using Scriban.Runtime;
using WireMock.Types;

namespace WireMock.Transformers.Scriban
namespace WireMock.Transformers.Scriban;

internal class WireMockTemplateContext : TemplateContext
{
internal class WireMockTemplateContext: TemplateContext
protected override IObjectAccessor GetMemberAccessorImpl(object target)
{
protected override IObjectAccessor GetMemberAccessorImpl(object target)
{
if (target?.GetType().GetGenericTypeDefinition() == typeof(WireMockList<>))
{
return new WireMockListAccessor();
}

return base.GetMemberAccessorImpl(target);
}
return target?.GetType().GetGenericTypeDefinition() == typeof(WireMockList<>) ?
new WireMockListAccessor() :
base.GetMemberAccessorImpl(target);
}
}
4 changes: 2 additions & 2 deletions src/WireMock.Net/WireMock.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="Scriban.Signed" Version="3.3.2" />
<PackageReference Include="Scriban.Signed" Version="5.5.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Nullable" Version="1.3.0" />

Expand All @@ -137,7 +137,7 @@

<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net5.0' or '$(TargetFramework)' == 'net6.0' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Scriban.Signed" Version="3.3.2" />
<PackageReference Include="Scriban.Signed" Version="5.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public CustomPathParamMatcher(string path, Dictionary<string, string> pathParams
MatchOperator = matchOperator;
}

public double IsMatch(string input)
public double IsMatch(string? input)
{
var inputParts = GetPathParts(input);
if (inputParts.Length != _pathParts.Length)
Expand Down Expand Up @@ -97,8 +97,13 @@ public double IsMatch(string input)

public MatchOperator MatchOperator { get; }

private static string[] GetPathParts(string path)
private static string[] GetPathParts(string? path)
{
if (path is null)
{
return new string[0];
}

var hashMarkIndex = path.IndexOf('#');
if (hashMarkIndex != -1)
{
Expand Down

0 comments on commit ae91ed2

Please sign in to comment.