Skip to content

Commit 91f8151

Browse files
committed
Validate unmapped parameters also if a body contract is involved
1 parent 1b88503 commit 91f8151

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

src/Dibix.Sdk.CodeGeneration/Lookup/ActionTargetDefinitionResolver.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,12 +167,9 @@ private ActionParameter CreateActionParameter(string name, TypeReference type, b
167167
location = ActionParameterLocation.Path;
168168
pathParameter.Visited = true;
169169
}
170-
else if (bodyParameters.Any())
170+
else if (bodyParameters.Contains(name))
171171
{
172172
location = ActionParameterLocation.Body;
173-
174-
if (bodyParameters.Contains(name))
175-
return null;
176173
}
177174
else
178175
{

tests/Dibix.Sdk.Tests/Resources/CodeGeneration/Endpoint_WithValidationErrors_Error.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Endpoints\GenericEndpointWithErrors.json(24,5,24,5):error:Missing required prope
1212
Endpoints\GenericEndpointWithErrors.json(40,20,40,20):error:Property 'X' not found on contract 'Dibix.Sdk.Tests.DomainModel.Request'
1313
Endpoints\GenericEndpointWithErrors.json(41,23,41,23):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
1414
Endpoints\GenericEndpointWithErrors.json(46,27,46,27):error:Property 'Nm' not found on contract 'Dibix.Sdk.Tests.DomainModel.Entry'
15+
Endpoints\GenericEndpointWithErrors.json(36,18,36,18):error:Location of parameter 'c' cannot be inferred. Please declare the source of the parameter.
16+
Endpoints\GenericEndpointWithErrors.json(36,18,36,18):error:Location of parameter 'password' cannot be inferred. Please declare the source of the parameter.
1517
Endpoints\GenericEndpointWithErrors.json(10,19,10,19):error:Source 'ENV' does not support property 'MachinePassword'
1618
Endpoints\GenericEndpointWithErrors.json(11,21,11,21):error:Source 'CLAIM' does not support property 'None'
1719
Endpoints\GenericEndpointWithErrors.json(16,21,16,21):error:The parameter 'wtf' is a path parameter, therefore cannot be read using the 'QUERY' source

0 commit comments

Comments
 (0)