fix(err): filter false-positive ExampleElement mutually exclusive resolver errors#10822
fix(err): filter false-positive ExampleElement mutually exclusive resolver errors#10822maruthang wants to merge 1 commit into
Conversation
|
Hi @maruthang, thanks for the PR. Unfortunately, I don’t think filtering out this error is the best solution. Instead, the error should be investigated and fixed in ApiDOM to address the root cause of the failure, rather than simply ignoring it. |
|
Thanks for the review @glowcloud — that's fair, filtering the symptom does leave the root cause in place. I'll dig into where the ExampleElement false-positive actually originates in ApiDOM and follow up there with a proper diagnosis (and a fix PR if I can pin it down). |
|
Followed up as promised: root cause diagnosed and fixed in ApiDOM — it's a double-traversal issue where the outer visitor re-visits an Example whose |
Description
Added an
ExampleMutuallyExclusiveerror transformer that filters out false-positive resolver errors where apidom-reference incorrectly reports "ExampleElement value and externalValue fields are mutually exclusive" when onlyexternalValueis present. The transformer is registered in the error transformer hook alongside the existingnot-of-typeandparameter-oneoftransformers.Motivation and Context
Fixes #10418
When a spec uses
$refat the path level and the referenced file contains examples withexternalValue, the upstream apidom-reference library throws a false-positive mutual exclusivity error. This causes Swagger UI to display a spurious error message to users even though their spec is valid. This fix suppresses those false-positive errors at the error transformer layer, following the same pattern already used for other known false-positive errors.How Has This Been Tested?
test/unit/core/plugins/err/transformers/example-mutually-exclusive.js:Screenshots (if appropriate):
N/A - no UI changes.
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests