Skip to content

fix(swagger): match go-openapi/loads' DocLoader signature at v0.25+ - #147

Merged
hsinatfootprintai merged 1 commit into
mainfrom
fix/loads-docloader-signature
Aug 28, 2026
Merged

fix(swagger): match go-openapi/loads' DocLoader signature at v0.25+#147
hsinatfootprintai merged 1 commit into
mainfrom
fix/loads-docloader-signature

Conversation

@hsinatfootprintai

Copy link
Copy Markdown
Contributor

Closes #146.

What broke, and why it's not obvious from this repo alone

go-openapi/loads v0.25.0 added a variadic loading.Option parameter to the exported DocLoader type. RenderDoc()'s embedFsLoader closure kept the pre-v0.25 signature, so it stops satisfying loads.DocLoader the moment anything in a build's dependency graph pulls loads past v0.22.x — direct or transitive. This repo still pins loads at v0.22.0, so it builds clean today; the break only shows up in a consumer's build once their own dependency graph (this repo included as a dependency) resolves a newer loads. grandturks hit it through a routine go-openapi/validate dependabot bump, with no way to work around it from their side — Go doesn't let a downstream module patch a dependency's function signature.

What changed

  • pkg/swagger/collections/apidoc.go: embedFsLoader now accepts the variadic loading.Option param (unused — the embedded FS loader needs none of what loads.Spec's callers can pass through it, e.g. a custom HTTP client or timeouts)
  • go.mod/go.sum: bumped go-openapi/validate to v0.26.4 (pulling loads to v0.25.1) so the fix is actually exercised by this repo's own build, rather than left latent for whoever bumps it downstream next

Test evidence

  • Reproduced first: bumped go-openapi/validate/loads locally and confirmed the exact compile error from grandturks's dependabot PR
  • go build ./..., go vet ./... clean
  • go test ./... -short — all green, including TestCollectionDoc (pkg/swagger/collections), which exercises RenderDoc() directly and produces the identical rendered document before and after — this is a signature adaptation, not a behavior change
  • vendor/ is gitignored and regenerated in CI (go mod tidy && go mod vendor), so nothing to commit there

🤖 Generated with Claude Code

Fixes #146.

go-openapi/loads v0.25.0 added a variadic loading.Option parameter to
the DocLoader type. embedFsLoader in RenderDoc() had the pre-v0.25
signature, so it stopped satisfying loads.DocLoader the moment
anything in the dependency graph pulls loads past v0.22.x - direct or
transitive. grandturks hit this transitively: a routine dependabot
bump of go-openapi/validate pulls loads up to v0.25.1 and fails to
build restcol as a dependency, with no way to work around it from the
consumer's side.

Bumps go-openapi/validate to the version that surfaced this (v0.26.4,
which itself requires loads v0.25.1) so the fix is exercised by this
repo's own build, not left to whoever bumps it next downstream.

The options parameter is unused - the embedded FS loader needs none of
what loads.Spec's own callers can pass through it (a custom HTTP
client, timeouts) - so it's accepted and discarded. Verified the
error reproduces on v0.22.0 and disappears with the fix; RenderDoc's
existing test (TestCollectionDoc) still passes and produces the same
document, so this is a signature adaptation, not a behavior change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@hsinatfootprintai
hsinatfootprintai merged commit 1a7c710 into main Aug 28, 2026
2 checks passed
@hsinatfootprintai
hsinatfootprintai deleted the fix/loads-docloader-signature branch August 28, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

swagger/apidoc: RenderDoc's embedFsLoader breaks against go-openapi/loads v0.25+ (DocLoader gained a variadic loading.Option param)

1 participant