Description
SpecificationHelpers.retrieveParsedSpec accepts multiple unrelated input shapes:
AsyncAPIDocument instance
stringified parsed spec
parsed plain JS object
legacy object exposing .json() method
This behavior is validated in tests but introduces ambiguity and weakens API guarantees.
Invalid or partially parsed inputs may be silently accepted, leading to unpredictable runtime behavior.
From a testing perspective, this masks incorrect usage instead of surfacing errors.
Expected Behavior
The helper should accept explicit and well-defined input types
Legacy or ambiguous input paths should:
be rejected, or
emit warnings, or
be explicitly deprecated
Tests should fail for unsupported or unclear input shapes
Steps to Reproduce
Open specification.test.ts
Call retrieveParsedSpec with:
a plain object marked with x-parser-spec-parsed
a legacy object exposing .json()
Observe that the function returns a parsed document without validating input origin or structure
File Affected:-asyncapi-react/library/src/helpers/tests/specification.test.ts