`Bundle` writes `components.pathItems` into OpenAPI 3.0 documents
Summary
For an OpenAPI 3.0 document, openapi.Bundle (and openapi spec bundle) moves a path item that lives in another file into components.pathItems. That field was added in 3.1: the 3.0 Components Object has no pathItems (its fixed fields are schemas, responses, parameters, examples, requestBodies, headers, securitySchemes, links and callbacks), so the bundled document is no longer valid 3.0.
Reproduction
openapi.yaml:
openapi: 3.0.3
info: {title: t, version: "1"}
paths:
/items:
$ref: ./paths/items.yaml
paths/items.yaml:
get:
responses:
"200":
description: ok
$ openapi spec bundle openapi.yaml
openapi: 3.0.3
info: {title: t, version: "1"}
paths:
/items:
$ref: '#/components/pathItems/items'
components:
pathItems:
items:
get:
responses:
"200":
description: ok
Expected result
A valid 3.0 document: with nowhere in 3.0 components to hold it, the path item written inline under paths./items. redocly bundle does this for the same input.
Actual result
components.pathItems in a 3.0.3 document. vacuum's oas3-schema rule rejects it (schema invalid: `/components` additional properties not allowed: `[pathItems]` ), while openapi spec validate reports it valid.
Version
v1.26.0 (also main, d269643). CLI from go install github.com/speakeasy-api/openapi/cmd/openapi@latest (v0.0.0-20261016011534-d2696438ec74).
Cause
bundleObject sends every ReferencedPathItem to bundleGenericReference(..., "pathItems") (openapi/bundle.go:199) whatever the document's openapi version.