Repository navigation
Closed
Labels
notable changesUsed for release notes to highlight these more highly
Milestone
Description
After updating oapi-codegen and the runtime with
go get -u github.com/oapi-codegen/runtime github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
go: upgraded github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 => v0.0.0-20260623150633-6f1ed93922d1
go: upgraded github.com/getkin/kin-openapi v0.133.0 => v0.145.0
go: upgraded github.com/go-openapi/jsonpointer v0.21.0 => v1.0.0
go: added github.com/go-openapi/swag/jsonname v0.27.3
go: upgraded github.com/oapi-codegen/oapi-codegen/v2 v2.5.1 => v2.8.0
go: upgraded github.com/oapi-codegen/runtime v1.4.1 => v1.6.0
go: upgraded github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 => v0.1.1
go: upgraded github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 => v0.0.14
go: added github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
go: upgraded github.com/speakeasy-api/jsonpath v0.6.0 => v0.6.3
go: added github.com/speakeasy-api/openapi v1.24.0
go: added go.yaml.in/yaml/v3 v3.0.5
go: added go.yaml.in/yaml/v4 v4.0.0-rc.6
go: upgraded golang.org/x/crypto v0.53.0 => v0.54.0
go: upgraded golang.org/x/mod v0.37.0 => v0.38.0
go: upgraded golang.org/x/net v0.56.0 => v0.57.0
go: upgraded golang.org/x/sys v0.46.0 => v0.47.0
go: upgraded golang.org/x/tools v0.47.0 => v0.48.0
running oapi-codegen failed:
go tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config cfg.yaml ./openapi_v1.yaml
# github.com/vmware-labs/yaml-jsonpath/pkg/yamlpath
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:29:9: cannot use p.f(node, root).ToArray() (value of type []*"go.yaml.in/yaml/v4".Node) as []*"gopkg.in/yaml.v3".Node value in return statement
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:57:32: cannot use node (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:70:33: cannot use node (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:75:33: cannot use node (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:80:33: cannot use node (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:190:22: cannot use node (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:200:25: cannot use a (variable of type *"go.yaml.in/yaml/v4".Node) as *"gopkg.in/yaml.v3".Node value in argument to p.f
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:218:33: cannot use node.Content[i] (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:236:37: cannot use node.Content[i] (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:252:44: cannot use n (variable of type *"gopkg.in/yaml.v3".Node) as *"go.yaml.in/yaml/v4".Node value in argument to yit.FromNode
../../../../../pkg/mod/github.com/vmware-labs/[email protected]/pkg/yamlpath/path.go:252:44: too many errors
server/api.go:3: running "go": exit status 1
Here the relevant parts of go.mod (after go mod tidy):
go 1.26.4
tool github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen
require (
github.com/oapi-codegen/runtime v1.4.1
)
require (
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/getkin/kin-openapi v0.133.0 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/oapi-codegen/oapi-codegen/v2 v2.5.1 // indirect
github.com/oasdiff/yaml v0.0.0-20250309154309-f31be36b4037 // indirect
github.com/oasdiff/yaml3 v0.0.0-20250309153720-d2182401db90 // indirect
github.com/speakeasy-api/jsonpath v0.6.0 // indirect
github.com/speakeasy-api/openapi-overlay v0.10.2 // indirect
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
github.com/vmware-labs/yaml-jsonpath v0.3.2 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Metadata
Metadata
Assignees
Labels
notable changesUsed for release notes to highlight these more highly
Activity
jamietanna commentedon Jul 30, 2026
Per https://github.com/oapi-codegen/oapi-codegen/releases/tag/v2.8.0 make sure you're using runtime
v1.6.0mromaszewicz commentedon Aug 2, 2026
He is using v2.8.0 of codegen with v1.6.0 of runtime. We hit this as well, since some of our indirect dependencies in the
v0.x.xsemver scheme break their API's from time to time, and we have to pin something else.mromaszewicz commentedon Aug 2, 2026
@vdobler , the problem here is
go-yit, which is unstable. Please downgrade it:There's a long import chain that leads to this conflict.
tiagocesar commentedon Oct 8, 2026
Just to add to the above - if more people work in your codebase and there's a risk of them upgrading the dependency, add a
replaceclause to yourgo.modfile:fastcat commentedon Oct 29, 2026
In my case the problem is that github.com/speakeasy-api/openapi v1.26.0 took in a BREAKING CHANGE (🤦♂️) swapping the underlying yaml dep
They did that, because the older yaml dep (which this repo uses) is unmaintained and is starting to get flagged by security scanners
mromaszewicz commentedon Oct 29, 2026
I think it's time to update out Go version to 1.26 and bump up some of these deps. I'll take care of it in the next few days, and we can see about replacing the YAML library.
mromaszewicz commentedon Oct 30, 2026
Even with go 1.26, we have issues with this
go-yitlibrary. I'd like to move to using this lib (https://github.com/theory/jsonpath) which does RFC compliant json path, but this breaks previous overlay API syntax. Maybe it's ok to update behavior here, since I think overlay usage is fringe, or maybe we can translate it for backward compatibility. Still looking into it.All these problems come from the overlay handling and using rotting old libs.
mromaszewicz commentedon Oct 30, 2026
Ok, I've figured out what I will do.
I'm going to remove overlay support from oapi-codegen, because it's not necessary, and most of the bugs we've had with this were due to overlaying and then re-serializing.
For the next release (v2.9.0), we will vendor in the speakeasy modules that we need, so as not to break behavior suddenly, but i will document that the release after that is losing overlay support. Users should actually run
github.com/speakeasy-api/openapi/cmd/openapidirectly, and produce an overlaid spec, which we then ingest without overlaying. It simplifies everything, removes a bug vector, removes many modules from our dependencies. I will updtate all documentation and examples in the upcoming release to use speakeasy's tool directly and encourage that as good behavior.jamietanna commentedon Oct 30, 2026
@mromaszewicz you mean removing OpenAPI Overlay? No, we shouldn't remove that
I don't agree that this is a good next step
The UX of it all being within
oapi-codegenis better than a separate step so we should look at what we can do to try and keep it inmromaszewicz commentedon Oct 30, 2026
I'm not sold on this, I'm thinking on options, and options which improve our stability.
Why does OpenAPI overlay have to be built into our executable?
You could do something like
The main reason I am considering replacing it, is that if you look at overlay bugs we've had in the past, a lot of them have to do with us running a portion of Speakeasy's code in-process and then re-marshaling the result to only unmarshal the YAML a second time for code generation. This path is somewhat fragile, and I was thinking how to avoid it.
The secondary reason is this broken Go packaging stuff and unstable transitive dependencies. @tiagocesar's suggestion to use
replace...won't work, becausereplaceonly affects our own module when we build it ourselves, it has no effect on a user's module imports. There's nothing we can pin for this to work properly.So, these are my options so far:
yaml-jsonpatharen't expressible in RFC 9535Anyhow, I'm open to other possibilities. What are you thinking, @jamietanna?
fastcat commentedon Oct 30, 2026
As an overlay user, my main use case is inserting
x-go-typeall over the place into third party specs.I'd be happy to rewrite those overlays to use a different syntax, but removing the functionality would be rather frustrating, esp. since it'd just push the problematic transitive deps problem onto me and, from my perspective, not really fix the issue.
mromaszewicz commentedon Oct 31, 2026
@fastcat , you wouldn't have the transitive deps problem at all, because using the speakeasy command line tool wouldn't pull in any.
I'll try to figure out how to keep this stuff compiling properly, it's just problematic.
fastcat commentedon Oct 31, 2026
Yes if i used it through e.g. go install, but I like to manage tools like this via go tool these days, so that their dependencies are as visible and maintainable as my own. But that brings with it the issues of compatibility of dependencies between multiple tools, and between them and my own code 🫤
mromaszewicz commentedon Oct 31, 2026
Yeah, I see your point.
Ok, so what I will do is make a new overlay handler on top of
theory/jsonpath. We don't need everything in Speakeasy's API. This new library supports RFC9535 syntax (and this is where Speakeasy is moving as well). I'll add a temporary syntax adapter that we'll maintain for a release or two to parse the old syntax, but the default behavior will be RFC9535.mromaszewicz commentedon Oct 31, 2026
Ok, we have a different implementation, and a different behavior by default, however, there's a compatibility mode for old syntax. Please see the README and commit description.
feat(overlay): apply overlays with an in-tree applier on theory/jsonp…
Use an old version of go-yit to avoid dependency incompatibilities