Skip to content

Commit

Permalink
Fix line position in EndpointModelValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
C0nquistadore committed Apr 29, 2022
1 parent 556f803 commit dfae1bc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ private void ReadControllerAction(string filePath, ControllerDefinition controll
actionDefinition.Method = method;
actionDefinition.OperationId = (string)action.Property("operationId")?.Value ?? actionDefinition.Target.OperationName;
actionDefinition.Description = (string)action.Property("description")?.Value;
actionDefinition.ChildRoute = childRouteProperty.ToToken(childRoute, filePath);
actionDefinition.ChildRoute = childRouteProperty?.Value.ToToken(childRoute, filePath);
actionDefinition.RequestBody = requestBody;

if (TryReadFileResponse(action, out ActionFileResponse fileResponse, out IJsonLineInfo fileResponseLocation))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private bool ValidateAction(ActionDefinition action)
{
if (HttpMethods.Contains(segment))
{
this._logger.LogError($"The path segment '{segment}' is a known HTTP verb, which should be indicated by the action method and is therefore redundant: {action.ChildRoute.Value}", action.ChildRoute.Source, action.ChildRoute.Line, columnOffset);
this._logger.LogError($"The path segment '{segment}' is a known HTTP verb, which should be indicated by the action method and is therefore redundant: {action.ChildRoute.Value}", action.ChildRoute.Source, action.ChildRoute.Line, action.ChildRoute.Column + columnOffset);
result = false;
}
columnOffset += segment.Length + 1; // Skip segment and slash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public void Endpoint_WithInvalidPropertySource_Error()
Endpoints\GenericEndpointWithErrors.json(18,20,18,20):error:Property 'X' not found on contract 'Dibix.Sdk.Tests.DomainModel.Request'
Endpoints\GenericEndpointWithErrors.json(19,23,19,23):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
Endpoints\GenericEndpointWithErrors.json(24,27,24,27):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
Endpoints\GenericEndpointWithErrors.json(16,5,16,5):error:The path segment 'get' is a known HTTP verb, which should be indicated by the action method and is therefore redundant: this/get/is/wrong"
Endpoints\GenericEndpointWithErrors.json(16,27,16,27):error:The path segment 'get' is a known HTTP verb, which should be indicated by the action method and is therefore redundant: this/get/is/wrong"
);
}

Expand Down

0 comments on commit dfae1bc

Please sign in to comment.