encoding/openapi: panic when generate openapi for values
What version of CUE are you using (cue version)?
$ cue version cuelang.org/go v0.4.4-0.20220729051708-0a46a1624353
Does this issue reproduce with the latest release?
yes
What did you do?
My cue value is like below:
#parameter: {
blocks?: *null | [...block]
attachments?: *null | {
blocks?: *null | [...block]
}
}
block: {
type: string
elements?: [...{
options?: [...option]
initial_options?: [...option]
}]
}
option: {
text: textType
description?: textType
}
textType: {
type: string
}
I only want to gen the openapi for #parameter so I lookup the #parameter and re-compile a cue inst like:
var r cue.Runtime
cueInst, err := r.Compile("-", test)
if err != nil {
panic(err)
}
v := cueInst.LookupDef("#parameter")
cueInst, err = r.Compile("-", fmt.Sprintf("#parameter: {%s}", string(s)))
if err != nil {
panic(err)
}
defaultConfig := &openapi.Config{ExpandReferences: true}
// panic here
b, err := openapi.Gen(cueInst, defaultConfig)
And a panic report when using openapi.Gen.
You can also check the example code here: https://gist.github.com/FogDong/a80852ce99d1588eb733567bebcf1cdc
Sorry for the complicated cue value example, I tried to make a simple one but the simple one won't cause panic.
What did you expect to see?
no panic report.
What did you see instead?
panic:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x102c2da60]
goroutine 1 [running]:
cuelang.org/go/encoding/openapi.schemas.func1(0x14000359d90)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:123 +0xac
panic({0x102f59780, 0x1032c2700})
/opt/homebrew/Cellar/[email protected]/1.17.10/libexec/src/runtime/panic.go:1038 +0x21c
cuelang.org/go/internal/core/adt.(*LetReference).resolve(0x140000a5960, 0x1400037a000, 0x2)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/expr.go:886 +0x40
cuelang.org/go/internal/core/adt.(*OpContext).Resolve(0x1400037a000, 0x14000372730, {0x102fd8250, 0x140000a5960})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/context.go:439 +0x110
cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr(0x14000377180, {0x14000372730, {0x102fd6b10, 0x140000a5980}, {0x14000370180, 0x0, 0x0, 0x0}})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:1440 +0x3a0
cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct(0x14000377180, {0x14000372730, {0x102fd6b10, 0x140000a5980}, {0x14000370180, 0x0, 0x0, 0x0}})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:1410 +0x708
cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts(0x14000377180, 0x5)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:421 +0xf8
cuelang.org/go/internal/core/adt.(*OpContext).Unify(0x1400037a000, 0x140003785a0, 0x5)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:255 +0xe7c
cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs(0x14000376a80, 0x5)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:732 +0x29c
cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct(0x14000376a80, 0x5)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:611 +0x7bc
cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts(0x14000376a80, 0x5, 0x14000376a80, 0x0, 0x0, 0x1)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/disjunct.go:151 +0x31c
cuelang.org/go/internal/core/adt.(*OpContext).Unify(0x1400037a000, 0x140003783f0, 0x5)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/eval.go:323 +0x92c
cuelang.org/go/internal/core/adt.(*Vertex).Finalize(...)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/internal/core/adt/composite.go:487
cuelang.org/go/cue.Value.LookupPath({0x1400031c700, 0x14000378360, 0x0}, {{0x14000358458, 0x1, 0x1}})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/cue/query.go:63 +0x2d8
cuelang.org/go/cue.Value.Elem({0x1400031c700, 0x14000378360, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/cue/types.go:1270 +0xa0
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x140000d6fd0, {0x1400031c700, 0x14000378120, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:143 +0x3d4
cuelang.org/go/encoding/openapi.(*builder).buildCoreStruct(0x140000d6f20, {0x1400031c700, 0x1400036be60, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:179 +0x10c
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x140000d6f20, {0x1400031c700, 0x1400036bdd0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:140 +0x390
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x140000d6e70, {0x1400031c700, 0x1400036bb00, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:150 +0x4dc
cuelang.org/go/encoding/openapi.(*builder).buildCoreStruct(0x140000d6a50, {0x1400031c700, 0x1400036b8c0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:179 +0x10c
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x140000d6a50, {0x1400031c700, 0x1400036b5f0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:140 +0x390
cuelang.org/go/encoding/openapi.(*builder).schema(0x140000d68f0, 0x0, {0x102ef33e0, 0x1}, {0x1400031c700, 0x1400036b5f0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:223 +0x280
cuelang.org/go/encoding/openapi.(*builder).array(0x140000d68f0, {0x1400031c700, 0x1400036af30, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:892 +0x8fc
cuelang.org/go/encoding/openapi.(*builder).dispatch(0x140000d68f0, 0x0, {0x1400031c700, 0x1400036af30, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:689 +0x3a0
cuelang.org/go/encoding/openapi.(*builder).value(0x140000d68f0, {0x1400031c700, 0x1400036ad80, 0x0}, 0x0)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:424 +0x774
cuelang.org/go/encoding/openapi.(*builder).disjunction(0x140000d68f0, {0x1400035b0e0, 0x2, 0x2}, 0x0)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:547 +0xc8
cuelang.org/go/encoding/openapi.(*builder).value(0x140000d68f0, {0x1400031c700, 0x1400036a900, 0x0}, 0x0)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:426 +0x70c
cuelang.org/go/encoding/openapi.(*builder).fillSchema(0x140000d68f0, {0x1400031c700, 0x1400036a900, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:260 +0xf4
cuelang.org/go/encoding/openapi.(*builder).coreSchema(0x140000d68f0)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:99 +0x144
cuelang.org/go/encoding/openapi.(*builder).coreSchemaWithName(0x140000d68f0, {0x140000a3a68, 0x6})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:61 +0x11c
cuelang.org/go/encoding/openapi.(*builder).coreSchema(0x140000d6840)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/crd.go:80 +0x2dc
cuelang.org/go/encoding/openapi.(*builder).schema(0x14000359968, 0x0, {0x140000a3a81, 0x9}, {0x1400031c700, 0x1400036a1b0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:224 +0x28c
cuelang.org/go/encoding/openapi.(*buildContext).build(0x140000c1720, {0x140000a3a81, 0x9}, {0x1400031c700, 0x1400036a1b0, 0x0})
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:184 +0x88
cuelang.org/go/encoding/openapi.schemas(0x14000359f08, 0x14000333b90)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/build.go:149 +0x818
cuelang.org/go/encoding/openapi.(*Config).All(0x14000359f08, 0x14000333b90)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/openapi.go:107 +0x30
cuelang.org/go/encoding/openapi.Gen(0x14000333b90, 0x14000359f08)
/Users/fog/Desktop/test-go/vendor/cuelang.org/go/encoding/openapi/openapi.go:79 +0x40
main.main()
/Users/fog/Desktop/test-go/main.go:700 +0x2e4
exit status 2
Looking at this now.
@FogDong - sorry, only just got round to looking at this. The example you link to in https://gist.github.com/FogDong/a80852ce99d1588eb733567bebcf1cdc does not compile with either v0.2.2 or tip. Perhaps you linked to the wrong file?
If you can show an example that works for v0.2.2 that will also be very helpful, thanks.
Here's the repro in v0.2.2 and I've also updated the gist with txtar-c: https://gist.github.com/FogDong/a80852ce99d1588eb733567bebcf1cdc
go mod tidy
go run main.go
-- go.mod --
module test-cue/openapi-1829
go 1.17
require cuelang.org/go v0.2.2
require (
github.com/cockroachdb/apd/v2 v2.0.1 // indirect
github.com/emicklei/proto v1.10.0 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
github.com/pkg/errors v0.8.1 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-- main.go --
package main
import (
"fmt"
"cuelang.org/go/cue"
"cuelang.org/go/cue/format"
"cuelang.org/go/encoding/openapi"
)
var test = `
#parameter: {
blocks?: *null | [...block]
attachments?: *null | {
blocks?: *null | [...block]
}
}
block: {
type: string
elements?: [...{
options?: [...option]
initial_options?: [...option]
}]
}
option: {
text: textType
description?: textType
}
textType: {
type: string
}
`
func main() {
var r cue.Runtime
cueInst, err := r.Compile("-", test)
if err != nil {
panic(err)
}
v := cueInst.LookupDef("#parameter")
s, err := format.Node(v.Syntax(cue.ResolveReferences(true)))
if err != nil {
panic(err)
}
cueInst, err = r.Compile("-", fmt.Sprintf("#parameter: {%s}", string(s)))
if err != nil {
panic(err)
}
defaultConfig := &openapi.Config{ExpandReferences: true}
b, err := openapi.Gen(cueInst, defaultConfig)
if err != nil {
panic(err)
}
fmt.Println(string(b))
}
-- stdout.golden --
{"openapi":"3.0.0","info":{"title":"Generated by cue.","version":"no version"},"paths":{},"components":{"schemas":{"parameter":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"elements":{"type":"array","items":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}},"initial_options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}}}}}}},"default":null,"nullable":true},"attachments":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"elements":{"type":"array","items":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}},"initial_options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}}}}}}},"default":null,"nullable":true}},"default":null,"nullable":true}}}}}}
Thanks, @FogDong. Here is a complete repro that shows the comparison using your expectation with stdout.golden. Note you have to do that comparison explicitly after the command where you want to assert the output. You also need to confirm that your expectation of such a test. e.g. that the test should pass without error, but that in this case it does not (see below):
# v0.2.2
go get cuelang.org/[email protected]
go mod tidy
go run main.go
cmp stdout stdout.golden
# tip
go get cuelang.org/[email protected]
go mod tidy
go run main.go
cmp stdout stdout.golden
-- go.mod --
module test-cue/openapi-1829
go 1.17
require cuelang.org/go v0.2.2
require (
github.com/cockroachdb/apd/v2 v2.0.1 // indirect
github.com/emicklei/proto v1.10.0 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect
github.com/pkg/errors v0.8.1 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
-- main.go --
package main
import (
"fmt"
"cuelang.org/go/cue"
"cuelang.org/go/cue/format"
"cuelang.org/go/encoding/openapi"
)
var test = `
#parameter: {
blocks?: *null | [...block]
attachments?: *null | {
blocks?: *null | [...block]
}
}
block: {
type: string
elements?: [...{
options?: [...option]
initial_options?: [...option]
}]
}
option: {
text: textType
description?: textType
}
textType: {
type: string
}
`
func main() {
var r cue.Runtime
cueInst, err := r.Compile("-", test)
if err != nil {
panic(err)
}
v := cueInst.LookupDef("#parameter")
s, err := format.Node(v.Syntax(cue.ResolveReferences(true)))
if err != nil {
panic(err)
}
cueInst, err = r.Compile("-", fmt.Sprintf("#parameter: {%s}", string(s)))
if err != nil {
panic(err)
}
defaultConfig := &openapi.Config{ExpandReferences: true}
b, err := openapi.Gen(cueInst, defaultConfig)
if err != nil {
panic(err)
}
fmt.Println(string(b))
}
-- stdout.golden --
{"openapi":"3.0.0","info":{"title":"Generated by cue.","version":"no version"},"paths":{},"components":{"schemas":{"parameter":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"elements":{"type":"array","items":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}},"initial_options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}}}}}}},"default":null,"nullable":true},"attachments":{"type":"object","properties":{"blocks":{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"elements":{"type":"array","items":{"type":"object","properties":{"options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}},"initial_options":{"type":"array","items":{"type":"object","required":["text"],"properties":{"text":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}},"description":{"type":"object","required":["type"],"properties":{"type":{"type":"string"}}}}}}}}}}},"default":null,"nullable":true}},"default":null,"nullable":true}}}}}}
The expectation is that this test should pass. But it fails with:
# v0.2.2 (0.350s)
# tip (1.714s)
> go get cuelang.org/[email protected]
[stderr]
go: upgraded cuelang.org/go v0.2.2 => v0.4.4-0.20220801114602-5a08d2f7a9a7
go: upgraded golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 => v0.0.0-20200804184101-5ec99f83aff1
> go mod tidy
> go run main.go
[stderr]
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x1eb568]
goroutine 1 [running]:
cuelang.org/go/encoding/openapi.schemas.func1()
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:123 +0x9c
panic({0x2c3880, 0x533820})
/home/myitcv/gos/src/runtime/panic.go:838 +0x20c
cuelang.org/go/internal/core/adt.(*LetReference).resolve(0x4000396f58?, 0x1e238c?, 0x28?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/expr.go:886 +0x38
cuelang.org/go/internal/core/adt.(*OpContext).Resolve(0x40003be000, 0x40003b8190, {0x374330, 0x40000ab380})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/context.go:439 +0x128
cuelang.org/go/internal/core/adt.(*nodeContext).evalExpr(0x40003c0380, {0x40003b8190, {0x3738a0, 0x40000ab3a0}, {0x40000abba0, 0x0, 0x0, 0x0}})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:1440 +0x338
cuelang.org/go/internal/core/adt.(*nodeContext).addExprConjunct(0x40003c0380, {0x40003b8190, {0x3738a0, 0x40000ab3a0}, {0x40000abba0, 0x0, 0x0, 0x0}})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:1410 +0x614
cuelang.org/go/internal/core/adt.(*nodeContext).insertConjuncts(0x40003c0380, 0x40?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:421 +0xe8
cuelang.org/go/internal/core/adt.(*OpContext).Unify(0x40003be000, 0x40003ba3f0, 0x5)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:255 +0xdac
cuelang.org/go/internal/core/adt.(*nodeContext).completeArcs(0x40003b5c00, 0x5)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:732 +0x264
cuelang.org/go/internal/core/adt.(*nodeContext).postDisjunct(0x40003b5c00, 0x5)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:611 +0x694
cuelang.org/go/internal/core/adt.(*nodeContext).expandDisjuncts(0x40003b5c00, 0xa8?, 0x40003b5c00, 0x0, 0x0, 0x1)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/disjunct.go:151 +0x320
cuelang.org/go/internal/core/adt.(*OpContext).Unify(0x40003be000, 0x40003ba240, 0x5)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/eval.go:323 +0x878
cuelang.org/go/internal/core/adt.(*Vertex).Finalize(...)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/internal/core/adt/composite.go:487
cuelang.org/go/cue.Value.LookupPath({0x4000093030?, 0x40003ba1b0?, 0x0?}, {{0x40003984d8?, 0x40003984e8?, 0x28a7a0?}})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/cue/query.go:63 +0x270
cuelang.org/go/cue.Value.Elem({0x4000093030?, 0x40003ba1b0?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/cue/types.go:1270 +0x8c
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x40000c2dc0, {0x4000093030?, 0x40003b1ef0?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:143 +0x340
cuelang.org/go/encoding/openapi.(*builder).buildCoreStruct(0x40000c2d10, {0x4000093030?, 0x40003b1cb0?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:179 +0xe8
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x40000c2d10, {0x4000093030?, 0x40003b1c20?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:140 +0x308
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x40000c2c60, {0x4000093030?, 0x40003b1950?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:150 +0x418
cuelang.org/go/encoding/openapi.(*builder).buildCoreStruct(0x40000c2840, {0x4000093030?, 0x40003b1710?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:179 +0xe8
cuelang.org/go/encoding/openapi.(*builder).buildCore(0x40000c2840, {0x4000093030?, 0x40003b1440?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:140 +0x308
cuelang.org/go/encoding/openapi.(*builder).schema(0x40000c26e0?, 0x0, {0x371b60?, 0x1?}, {0x4000093030?, 0x40003b1440?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:223 +0x268
cuelang.org/go/encoding/openapi.(*builder).array(0x40000c26e0, {0x4000093030?, 0x40003b0d80?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:892 +0x758
cuelang.org/go/encoding/openapi.(*builder).dispatch(0x40000c26e0, 0x40003b0d80?, {0x4000093030?, 0x40003b0d80?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:689 +0x348
cuelang.org/go/encoding/openapi.(*builder).value(0x40000c26e0, {0x4000093030?, 0x40003b0bd0?, 0x0?}, 0x302340?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:424 +0x618
cuelang.org/go/encoding/openapi.(*builder).disjunction(0x40000c26e0, {0x400039f800?, 0x2?, 0x2?}, 0x4000093030?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:547 +0xbc
cuelang.org/go/encoding/openapi.(*builder).value(0x40000c26e0, {0x4000093030?, 0x40003b0750?, 0x0?}, 0x85b8?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:426 +0x5dc
cuelang.org/go/encoding/openapi.(*builder).fillSchema(0x40000c26e0, {0x4000093030?, 0x40003b0750?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:260 +0xc4
cuelang.org/go/encoding/openapi.(*builder).coreSchema(0x40000c26e0)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:99 +0x10c
cuelang.org/go/encoding/openapi.(*builder).coreSchemaWithName(0x40000c26e0, {0x400008c5ea?, 0x6?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:61 +0x100
cuelang.org/go/encoding/openapi.(*builder).coreSchema(0x40000c2630)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/crd.go:80 +0x240
cuelang.org/go/encoding/openapi.(*builder).schema(0x4000399a08?, 0x0, {0x400008c5e1?, 0x9?}, {0x4000093030?, 0x40003b0000?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:224 +0x270
cuelang.org/go/encoding/openapi.(*buildContext).build(0x40000a6280?, {0x400008c5e1, 0x9}, {0x4000093030?, 0x40003b0000?, 0x0?})
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:184 +0x8c
cuelang.org/go/encoding/openapi.schemas(0x4000399f08, 0x40000bb7a0)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/build.go:149 +0x768
cuelang.org/go/encoding/openapi.(*Config).All(0x4000287e88?, 0x28e648?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/openapi.go:107 +0x28
cuelang.org/go/encoding/openapi.Gen(0x4000093030?, 0x371ac8?)
/home/myitcv/gostuff/pkg/mod/cuelang.org/[email protected]/encoding/openapi/openapi.go:79 +0x3c
main.main()
$WORK/main.go:54 +0x17c
exit status 2
[exit status 1]
FAIL: /tmp/testscript1240220359/repro.txtar/script.txt:10: unexpected go command failure
Initial analysis shows this looks related to https://github.com/cue-lang/cue/issues/1828. let expressions are being more readily exercised following the self-contained changes.
Thanks for the detailed instructions, I will follow the steps to generate the repro.
@rogpeppe / @myitcv there appears to be no crash anymore. Can one of you verify this is now fixed please?
@mpvl I rechecked the repro and it's fixed now. Thanks for the fix.