Skip to content
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

fix: allow PropertyNamingPolicy = null #119

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void Apply(ParameterModel parameter)
foreach (var actionSelector in parameter.Action.Selectors)
{
var jsonSerializerOptions = ServerUtils.GetDataJsonSerializerOptions(actionSelector.EndpointMetadata, options, serializerOptionsProviders);
var propertyName = jsonSerializerOptions.PropertyNamingPolicy!.ConvertName(parameter.ParameterName);
var propertyName = jsonSerializerOptions.ConvertName(parameter.ParameterName);
var parametersMetadata = actionSelector.EndpointMetadata.Get<JsonRpcActionParametersMetadata>();
if (parametersMetadata == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ private string GetMethodName(ActionModel action, SelectorModel selector)
var methodStyleAttribute = selector.EndpointMetadata.Get<JsonRpcMethodStyleAttribute>();
var methodStyle = methodStyleAttribute?.MethodStyle ?? options.DefaultMethodStyle;

var controllerName = jsonSerializerOptions.PropertyNamingPolicy!.ConvertName(action.Controller.ControllerName);
var actionName = jsonSerializerOptions.PropertyNamingPolicy.ConvertName(action.ActionName);
var controllerName = jsonSerializerOptions.ConvertName(action.Controller.ControllerName);
var actionName = jsonSerializerOptions.ConvertName(action.ActionName);
return methodStyle switch
{
JsonRpcMethodStyle.ControllerAndAction => $"{controllerName}{JsonRpcConstants.ControllerMethodSeparator}{actionName}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@
{
new JsonRpcControllerAttribute()
},
ControllerName = controllerName,

Check warning on line 1012 in src/tests/Tochka.JsonRpc.OpenRpc.Tests/Services/OpenRpcDocumentGeneratorTests.cs

View workflow job for this annotation

GitHub Actions / test

Possible null reference assignment.
MethodInfo = action?.Method ?? ((Action) ValidMethod).Method,
ControllerTypeInfo = new TypeDelegator(typeof(ValidJsonRpcController))
},
Expand All @@ -1028,7 +1028,7 @@
{
}

private class ValidJsonRpcController : JsonRpcControllerBase
private sealed class ValidJsonRpcController : JsonRpcControllerBase
{
public void ValidJsonRpcMethod()
{
Expand Down
Loading