fix(inbound-api): resolve InboundAPI-012 — move ParameterDefinition POCO to ScadaLink.Commons (Types/InboundApi)
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
| Last reviewed | 2026-05-16 |
|
| Last reviewed | 2026-05-16 |
|
||||||
| Reviewer | claude-agent |
|
| Reviewer | claude-agent |
|
||||||
| Commit reviewed | `9c60592` |
|
| Commit reviewed | `9c60592` |
|
||||||
| Open findings | 1 |
|
| Open findings | 0 |
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
@@ -500,7 +500,7 @@ indistinguishable contract.
|
|||||||
|--|--|
|
|--|--|
|
||||||
| Severity | Low |
|
| Severity | Low |
|
||||||
| Category | Code organization & conventions |
|
| Category | Code organization & conventions |
|
||||||
| Status | Open |
|
| Status | Resolved |
|
||||||
| Location | `src/ScadaLink.InboundAPI/ParameterValidator.cs:128-133` |
|
| Location | `src/ScadaLink.InboundAPI/ParameterValidator.cs:128-133` |
|
||||||
|
|
||||||
**Description**
|
**Description**
|
||||||
@@ -521,18 +521,27 @@ components that work with method definitions.
|
|||||||
|
|
||||||
**Resolution**
|
**Resolution**
|
||||||
|
|
||||||
_Unresolved — left Open; the fix crosses this module's editable boundary._
|
Resolved 2026-05-16 (commit `<pending>`): root cause confirmed against the source —
|
||||||
Re-triage 2026-05-16: confirmed against the source — `ParameterDefinition`
|
`ParameterDefinition` was a persistence-ignorant, API-contract-shaped POCO (the
|
||||||
(`ParameterValidator.cs:128-133`) is indeed an API-contract-shaped POCO declared in
|
deserialized form of the `ApiMethod.ParameterDefinitions` configuration-database
|
||||||
the component project. However the recommended fix is to **create the type in
|
column) declared inside the component project, contrary to CLAUDE.md's
|
||||||
`ScadaLink.Commons`** (and update the validator plus any other consumers to reference
|
code-organization rule that such shared contract types live in `ScadaLink.Commons`.
|
||||||
it), which edits files outside this module's editable scope
|
The type was moved to `src/ScadaLink.Commons/Types/InboundApi/ParameterDefinition.cs`
|
||||||
(`src/ScadaLink.InboundAPI`, `tests/`, this file only). It also touches a shared
|
(namespace `ScadaLink.Commons.Types.InboundApi`) — placed under `Types/` with an
|
||||||
contract type: a Commons namespace placement and a likely-paired return-definition
|
`InboundApi` domain subfolder, matching the existing `Types/Scripts/` precedent, since
|
||||||
type are a cross-component code-organization decision. **Surface to the design/Commons
|
the column itself is the persisted form and this type is its deserialized contract
|
||||||
owner:** add `ParameterDefinition` (and a return-definition counterpart) under a
|
shape (not an EF-mapped entity). It remains a pure POCO with no EF attributes and no
|
||||||
`ScadaLink.Commons` InboundApi types namespace, then repoint `ParameterValidator` and
|
behaviour. `ParameterValidator` now imports the moved type via a `using
|
||||||
any other consumers at it.
|
ScadaLink.Commons.Types.InboundApi;` directive; a tree-wide search confirmed
|
||||||
|
`ParameterValidator.cs` was the type's only declaration and only direct consumer (all
|
||||||
|
other `ParameterDefinition*` matches are the unrelated `ParameterDefinitions` string
|
||||||
|
property). No return-definition type exists in the codebase — only a `ReturnDefinition`
|
||||||
|
string column — so none was invented. No behavioural change, so no new runtime
|
||||||
|
regression test: this is a compile-level type move, and the existing 52
|
||||||
|
`ScadaLink.InboundAPI.Tests` (including the `ParameterValidator` suite) act as the
|
||||||
|
regression guard. `dotnet test` for `ScadaLink.InboundAPI.Tests` (52 passed) and
|
||||||
|
`ScadaLink.Commons.Tests` (226 passed) are green; `dotnet build ScadaLink.slnx`
|
||||||
|
succeeds with 0 warnings / 0 errors.
|
||||||
|
|
||||||
### InboundAPI-013 — `ApiKeyValidationResult.NotFound` factory returns HTTP 400, contradicting its name
|
### InboundAPI-013 — `ApiKeyValidationResult.NotFound` factory returns HTTP 400, contradicting its name
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
namespace ScadaLink.Commons.Types.InboundApi;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Defines a single parameter in an inbound API method's parameter definitions.
|
||||||
|
/// This is the deserialized, persistence-ignorant form of the JSON stored in
|
||||||
|
/// <c>ApiMethod.ParameterDefinitions</c> and describes the public API contract,
|
||||||
|
/// so it is shared by every component that reads or produces method parameter
|
||||||
|
/// definitions (Inbound API, Central UI method editor, CLI, Management Service).
|
||||||
|
/// </summary>
|
||||||
|
public class ParameterDefinition
|
||||||
|
{
|
||||||
|
public string Name { get; set; } = string.Empty;
|
||||||
|
public string Type { get; set; } = "String";
|
||||||
|
public bool Required { get; set; } = true;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using ScadaLink.Commons.Types.InboundApi;
|
||||||
|
|
||||||
namespace ScadaLink.InboundAPI;
|
namespace ScadaLink.InboundAPI;
|
||||||
|
|
||||||
@@ -142,16 +143,6 @@ public static class ParameterValidator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Defines a parameter in a method's parameter definitions.
|
|
||||||
/// </summary>
|
|
||||||
public class ParameterDefinition
|
|
||||||
{
|
|
||||||
public string Name { get; set; } = string.Empty;
|
|
||||||
public string Type { get; set; } = "String";
|
|
||||||
public bool Required { get; set; } = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Result of parameter validation.
|
/// Result of parameter validation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user