Parse and cache an OpenAPI document. Returns the cached parse for the
same object identity.
Before parsing, the document is run through the version-aware
normalisation pipeline (normaliseOpenApiSchemas) so OpenAPI 3.0.x
keywords (nullable, discriminator, example), OpenAPI 3.1.x
discriminator, and Swagger 2.0 documents are all converted to
canonical Draft 2020-12 form. The parser and downstream extractors
(extractRequestBody, extractResponses, etc.) then observe schemas in the
same form <SchemaComponent> does, keeping the OpenAPI components on
the same pipeline as the top-level adapter.
Caching and diagnostics
Normalisation runs at most once per document identity. The full set
of doc-level diagnostics emitted during that single run is captured
into the cache alongside the parsed result. Each caller-supplied
sink receives the captured diagnostics exactly once per cached
entry, no matter how many times getParsed is called with that
(doc, sink) pair.
The previous implementation bypassed the cache whenever
diagnostics was supplied and re-ran the entire normalisation
pipeline against the new sink. That fired every doc-level
diagnostic once per call, so a parent like ApiWebhooks that
renders ApiWebhook per webhook entry caused N-fold emission of a
single real cause. With the new strategy, cardinality stays at one
per real cause regardless of how many child renders share the
sink.
Strict mode is treated as a per-call invariant — see the internal
replayCapturedDiagnostics helper below for the rationale.
Parse and cache an OpenAPI document. Returns the cached parse for the same object identity.
Before parsing, the document is run through the version-aware normalisation pipeline (
normaliseOpenApiSchemas) so OpenAPI 3.0.x keywords (nullable,discriminator,example), OpenAPI 3.1.xdiscriminator, and Swagger 2.0 documents are all converted to canonical Draft 2020-12 form. The parser and downstream extractors (extractRequestBody,extractResponses, etc.) then observe schemas in the same form<SchemaComponent>does, keeping the OpenAPI components on the same pipeline as the top-level adapter.Caching and diagnostics
Normalisation runs at most once per document identity. The full set of doc-level diagnostics emitted during that single run is captured into the cache alongside the parsed result. Each caller-supplied sink receives the captured diagnostics exactly once per cached entry, no matter how many times
getParsedis called with that(doc, sink)pair.The previous implementation bypassed the cache whenever
diagnosticswas supplied and re-ran the entire normalisation pipeline against the new sink. That fired every doc-level diagnostic once per call, so a parent likeApiWebhooksthat rendersApiWebhookper webhook entry caused N-fold emission of a single real cause. With the new strategy, cardinality stays at one per real cause regardless of how many child renders share the sink.Strict mode is treated as a per-call invariant — see the internal
replayCapturedDiagnosticshelper below for the rationale.