We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I ran into a panic when certain names (e.g. allOf, anyOf) are set as required properties with v0.21.7.
allOf
anyOf
v0.21.7
required: - allOf
The panic occurs on the BuildV3Model call:
BuildV3Model
panic: runtime error: index out of range [1] with length 1 goroutine 1 [running]: github.com/pb33f/libopenapi/index.(*Resolver).extractRelatives(0xc000140000, 0xc000128000, 0xc00029afa0, 0xc00029ae60, 0xc0002e4bd8, {0xc00012a048, 0x1, 0x1}, 0xc0002e4a90, 0x0, ...) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/resolver.go:756 +0x230a github.com/pb33f/libopenapi/index.(*Resolver).extractRelatives(0xc000140000, 0xc000128000, 0xc00029ae60, 0x0, 0xc0002e4bd8, {0xc00012a048, 0x1, 0x1}, 0xc0002e4a90, 0x0, ...) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/resolver.go:508 +0x59f github.com/pb33f/libopenapi/index.(*Resolver).VisitReference(0xc000140000, 0xc000128000, 0xc0002e4bd8, {0x0?, 0x137ec0d1aee9?, 0xc0002e4b58?}, 0x0) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/resolver.go:338 +0x1ee github.com/pb33f/libopenapi/index.visitIndexWithoutDamagingIt(0xc000140000, 0xc000286588) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/resolver.go:258 +0x23b github.com/pb33f/libopenapi/index.(*Resolver).CheckForCircularReferences(0xc000140000) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/resolver.go:219 +0x2a github.com/pb33f/libopenapi/index.(*Rolodex).CheckForCircularReferences(0xc000294340) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/index/rolodex.go:423 +0x47 github.com/pb33f/libopenapi/datamodel/low/v3.createDocument(0xc00029c0b0, 0xc0002a0000) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/datamodel/low/v3/create_document.go:119 +0x91f github.com/pb33f/libopenapi/datamodel/low/v3.CreateDocumentFromConfig(...) /home/user/go/pkg/mod/github.com/pb33f/libopenapi@v0.21.7/datamodel/low/v3/create_document.go:30 github.com/pb33f/libopenapi.(*document).BuildV3Model(0xc0002bc0c0)
func TestRequiredPanic(t *testing.T) { spec := ` openapi: 3.0.1 info: title: Test version: 1.0.0 paths: /endpoint: get: components: schemas: ExampleSchema: required: - allOf type: object properties: allOf: type: string ` doc, err := libopenapi.NewDocument([]byte(spec)) assert.NoError(t, err) assert.NotNil(t, doc) v3Model, errs := doc.BuildV3Model() // panic occurs here assert.Empty(t, errs) assert.NotNil(t, v3Model) }
The text was updated successfully, but these errors were encountered:
Damn, I saw this myself in the wild the other day. Will fix.
Sorry, something went wrong.
This has been fixed in v0.21.8
v0.21.8
This bug literally blew up the doctor and left it dead for hours.
No branches or pull requests
Description
I ran into a panic when certain names (e.g.
allOf
,anyOf
) are set as required properties withv0.21.7
.The panic occurs on the
BuildV3Model
call:Test-Case to Reproduce
The text was updated successfully, but these errors were encountered: