Multi-spec merge fails on equivalent duplicate schemas
bug
## Summary
Generating from multiple `openApiPaths` fails when Refitter encounters schema conflicts like in the e-conomic OpenAPI specs (`economic-products.json` and `economic-webhooks.json`)
Both OpenAPI files define shared schemas such as `Error` and `ProblemDetails`. Those schemas are equivalent, but the merge logic treats them as hard conflicts and stops generation.
> The OpenAPI files should **not** be modified to work around this.
## Repro
1. Use the existing `test\multiple-sources.refitter` file:
```json
{
"openApiPaths": [
"OpenAPI/v3.0/economic-products.json",
"OpenAPI/v3.0/economic-webhooks.json"
],
"namespace": "Economic",
"outputFolder": "GeneratedCode"
}
```
2. Run Refitter against that file.
## Expected behavior
Refitter should merge the two specs, accept equivalent duplicate schemas, and generate non-empty, buildable code.
## Actual behavior
Generation fails during multi-spec merge with a duplicate schema error, even though the duplicated schemas are structurally the same.
## Root cause
The merge logic failed fast on duplicate schema names unless the existing and incoming values compared equal in a narrow way. That was too strict for equivalent schemas loaded from separate documents, especially when schemas referenced other shared schemas such as `ProblemDetails -> Error`.
## Fix summary
- Compare duplicate schemas structurally instead of treating every same-name duplicate as a conflict.
- Keep fail-fast behavior for real schema differences.
- Add regression coverage for equivalent duplicate schema handling, including the real e-conomic multi-spec scenario.
关闭于 2026-04-28 5 条评论