Skip to content

Commit dfae1bc

Browse files
committed
Fix line position in EndpointModelValidator
1 parent 556f803 commit dfae1bc

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Dibix.Sdk/CodeGeneration/Model/ControllerDefinitionProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ private void ReadControllerAction(string filePath, ControllerDefinition controll
147147
actionDefinition.Method = method;
148148
actionDefinition.OperationId = (string)action.Property("operationId")?.Value ?? actionDefinition.Target.OperationName;
149149
actionDefinition.Description = (string)action.Property("description")?.Value;
150-
actionDefinition.ChildRoute = childRouteProperty.ToToken(childRoute, filePath);
150+
actionDefinition.ChildRoute = childRouteProperty?.Value.ToToken(childRoute, filePath);
151151
actionDefinition.RequestBody = requestBody;
152152

153153
if (TryReadFileResponse(action, out ActionFileResponse fileResponse, out IJsonLineInfo fileResponseLocation))

src/Dibix.Sdk/CodeGeneration/Validation/EndpointModelValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private bool ValidateAction(ActionDefinition action)
4343
{
4444
if (HttpMethods.Contains(segment))
4545
{
46-
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);
46+
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);
4747
result = false;
4848
}
4949
columnOffset += segment.Length + 1; // Skip segment and slash

tests/Dibix.Sdk.Tests/CodeGeneration/CodeGenerationTaskTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ public void Endpoint_WithInvalidPropertySource_Error()
541541
Endpoints\GenericEndpointWithErrors.json(18,20,18,20):error:Property 'X' not found on contract 'Dibix.Sdk.Tests.DomainModel.Request'
542542
Endpoints\GenericEndpointWithErrors.json(19,23,19,23):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
543543
Endpoints\GenericEndpointWithErrors.json(24,27,24,27):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
544-
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"
544+
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"
545545
);
546546
}
547547

0 commit comments

Comments
 (0)