Skip to content

Using kin-openapi > 0.120.0 no longer results in build errors, due to upstream changes #1365

@tandem97

Description

@tandem97

Hi! I face strange situation using go generate with oapi-codegen. This is simple example to reproduce it

main.go

//go:generate go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen --version
package main

import (
	_ "github.com/getkin/kin-openapi/openapi3"
)

func main() {}

tools.go

//go:build tools

package tools

import (
	_ "github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen"
)

go.mod

module test2

go 1.21.0

require (
	github.com/deepmap/oapi-codegen/v2 v2.0.0
	github.com/getkin/kin-openapi v0.122.0
)

require (
	github.com/go-openapi/jsonpointer v0.19.6 // indirect
	github.com/go-openapi/swag v0.22.4 // indirect
	github.com/invopop/yaml v0.2.0 // indirect
	github.com/josharian/intern v1.0.0 // indirect
	github.com/mailru/easyjson v0.7.7 // indirect
	github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
	github.com/perimeterx/marshmallow v1.1.5 // indirect
	golang.org/x/mod v0.12.0 // indirect
	golang.org/x/sys v0.12.0 // indirect
	golang.org/x/text v0.13.0 // indirect
	golang.org/x/tools v0.12.0 // indirect
	gopkg.in/yaml.v2 v2.4.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
)

If you run go generate you will get error. The only sollution i found, is to downgrade module dep github.com/getkin/kin-openapi to v0.120.0. What is wrong, ho to use tools.go with oapi-codegen and kin-openapi together? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions