Bug: Panic "assignment to entry in nil map"
Closed this issue · 2 comments
taraktikos commented
For some schemas the following panic is happening:
panic({0xe9c640, 0x12ce850})
runtime/panic.go:884 +0x212
github.com/santhosh-tekuri/jsonschema/v5.(*resource).resolveFragment(0xc000c3c6e0, 0x73?, 0xc000cc6480?, {0xc000cc64e0?, 0xc0006b8318?})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/resource.go:166 +0x5cd
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compileRef(0x0?, 0xc000c3c6e0, {0x0?, 0x0, 0x0}, {0xc000773518, 0x11}, 0xff8b5f?, {0xc000cc6480, 0x73})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:199 +0x21c
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compileMap.func1({0x0, 0x0, 0x0}, {0xc000773518, 0x11})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:326 +0xd6
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compileMap(0xc00060e630, 0xc000c3c6e0, {0x0?, 0x0, 0xfe9018?}, {{0xfe9018?, 0xc0006b88a0?}, 0xc000cc8a80?, 0xc0?}, 0xc000c3c6e0)
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:382 +0x306e
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compile(0x60?, 0xfe9018?, {0x0, 0x0, 0x0}, {{0xfe9018?, 0x25?}, 0xc000cc8a80?, 0x1f?}, 0xc000c3c6e0)
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:249 +0x14c
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compileRef(0x60?, 0xc000c3c6e0, {0x0?, 0x0, 0x0}, {0xfe9018, 0x1}, 0x40d907?, {0xfe9018, 0x1})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:215 +0x307
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).compileURL(0xc0006952c0?, {0xc0006952c0, 0x60}, {0x0, 0x0, 0x0}, {0xfe9018, 0x1})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:183 +0x112
github.com/santhosh-tekuri/jsonschema/v5.(*Compiler).Compile(0xc00047f380?, {0xc0006952c0, 0x60})
github.com/santhosh-tekuri/jsonschema/v5@v5.0.0/compiler.go:114 +0x105
santhosh-tekuri commented
r.subresources
should not be nil as per implementation
simple nil check will resolve panic but implementation issue will still exist
need sample schema to reproduce this issue for investigating actual problem
santhosh-tekuri commented
Not reproducable