Skip to content

Commit fd77423

Browse files
committed
refactor: update GetParameterValueForWatch to include an optional init parameter for improved flexibility
1 parent bc0acaa commit fd77423

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/LibKubernetesGenerator/ParamHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void RegisterHelper(ScriptObject scriptObject)
2323
scriptObject.Import(nameof(GetModelCtorParam), new Func<JsonSchema, string>(GetModelCtorParam));
2424
scriptObject.Import(nameof(IfParamContains), IfParamContains);
2525
scriptObject.Import(nameof(FilterParameters), FilterParameters);
26-
scriptObject.Import(nameof(GetParameterValueForWatch), new Func<OpenApiParameter, bool, string>(GetParameterValueForWatch));
26+
scriptObject.Import(nameof(GetParameterValueForWatch), new Func<OpenApiParameter, bool, string, string>(GetParameterValueForWatch));
2727
}
2828

2929
public static bool IfParamContains(OpenApiOperation operation, string name)
@@ -47,15 +47,15 @@ public static IEnumerable<OpenApiParameter> FilterParameters(OpenApiOperation op
4747
return operation.Parameters.Where(p => p.Name != excludeParam);
4848
}
4949

50-
public string GetParameterValueForWatch(OpenApiParameter parameter, bool watch)
50+
public string GetParameterValueForWatch(OpenApiParameter parameter, bool watch, string init = "false")
5151
{
5252
if (parameter.Name == "watch")
5353
{
5454
return watch ? "true" : "false";
5555
}
5656
else
5757
{
58-
return generalNameHelper.GetDotNetNameOpenApiParameter(parameter, "false");
58+
return generalNameHelper.GetDotNetNameOpenApiParameter(parameter, init);
5959
}
6060
}
6161

0 commit comments

Comments
 (0)