[v2.0 audit][L12] Reordering of interface-generator construction in Generate() is correct but fragile
bugpriority:p2audit:v2.0
**Severity:** Low | **Component:** Refitter.Core | **v2.0 audit (since v1.7.3)**
The diff comment correctly explains that `interfaceGenerator` must be instantiated *before* `generator.GenerateFile()` so that `CheckForDuplicateOperationIds` sees the original operation IDs (NSwag mutates them during `GenerateFile`). This is now done in two places (`Generate` and `GenerateMultipleFiles`). Anybody adding a third entry point will easily reintroduce the bug.
### Code
- `src/Refitter.Core/RefitGenerator.cs:136-149, 196-215`
### Fix
Encapsulate the "create interface generator + then call GenerateFile" sequence in a single private helper, or capture the original operation IDs in the interface generator's constructor so generation order no longer matters.
0 条评论