emicklei / go-restful-openapi

OpenAPI extension in Go for the go-restful package

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

openapi stack overflow when read protobuf struct

emicklei opened this issue · comments

i have difficulties finding a test that demonstrates the issue

@fanux can you change this example to your structure such that it fails?


func TestRecursiveFieldStructure(t *testing.T) {
	type Foo struct{}
	type Bar struct {
		Foo `json:"foo"`
		B   struct {
			Foo
			f Foo
			b *Bar
		}
	}
	db := definitionBuilder{Definitions: spec.Definitions{}, Config: Config{}}
	db.addModelFrom(Foo{})
	t.Log(db)
}
commented

type Foo struct{
	b *Bar
}
type Bar struct {
	Foo `json:"foo"`
	B   struct {
		Foo
		f Foo
		b []*Bar
	}
}
func TestRecursiveFieldStructure(t *testing.T) {
	db := definitionBuilder{Definitions: spec.Definitions{}, Config: Config{}}
	db.addModelFrom(Foo{})
	t.Log(db)
}

This case will reproduce it.

works on my machine :-(. , the v2 branch

@fanux did you use the v2 branch?

commented

Not yet, but I think if the test case passed, this issue can be closed