There was an invalid path used for leafref. Then the freeconf/yang library crashed.
It should be better to retun an error in such cases.
goroutine 1 [running]:
github.com/freeconf/yang/meta.Find({0x1108010, 0xc0004a35e0}, {0xc000278c95, 0x4})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/find.go:33 +0x328
github.com/freeconf/yang/meta.Find({0x1108010, 0xc0004a35e0}, {0xc000278c95, 0x1c})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/find.go:13 +0x113
github.com/freeconf/yang/meta.(*compiler).compileType(0xc0004a3500?, 0xc0000763c0, {0x26a274955d8?, 0xc0004a35e0})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:264 +0x20d
github.com/freeconf/yang/meta.(*compiler).compile(0xc0004d25a0?, {0x1066220?, 0xc0004a35e0?})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:79 +0x15f
github.com/freeconf/yang/meta.(*compiler).compile(0x1108eb0?, {0x106a8a0?, 0xc0004d25a0?})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:132 +0x585
github.com/freeconf/yang/meta.(*compiler).compile(0xc0001b4510?, {0x106abc0?, 0xc000002000?})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:132 +0x585
github.com/freeconf/yang/meta.(*compiler).module(0x10?, 0xc000002000)
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:52 +0x206
github.com/freeconf/yang/meta.Compile(0xc000002000)
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/meta/compile.go:21 +0x4a
github.com/freeconf/yang/parser.LoadModuleWithOptions(0xc0004c58c0, {0xc0000161e0, 0x14}, {{0x0?, 0x0?}, {0x0?, 0xc00051dc60?}})
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/parser/loader.go:72 +0x1fd
github.com/freeconf/yang/parser.LoadModule(...)
C:/Users/dama0416/go/pkg/mod/github.com/freeconf/[email protected]/parser/loader.go:16
e2eso-json-schema-generator/generator/yangparser.(*YangParser).ParseAndGenerateJsonSchema(0xc00051dcc0)
C:/MYDATA/ESO/WORK/e2eso-json-schema-generator/e2eso-json-schema-generator/generator/yangparser/parser.go:34 +0x5f
e2eso-json-schema-generator/generator/yangparser.ConvertYangFilesToJsonSchema({0x1108a78, 0xc0001b4390}, {0xc0000a01fa?, 0x1104880?}, {0xc0000161e0, 0x14}, {0xc00051de08, 0x2}, 0x8?)
C:/MYDATA/ESO/WORK/e2eso-json-schema-generator/e2eso-json-schema-generator/generator/yangparser/parser.go:282 +0xde
main.main()
C:/MYDATA/ESO/WORK/e2eso-json-schema-generator/e2eso-json-schema-generator/main.go:92 +0x686
module leafref-invalid-path {
namespace urn:x;
prefix x;
revision 2023-01-01;
container logical-switch {
description
"Logical switch parameters";
leaf server {
type leafref {
path "abcd/../../syslog-servers/id";
}
description
"The reference to SDX - SYSLOG server";
}
}
list syslog-servers {
key "id";
leaf id {
type uint32;
description
"The unique ID of SYSLOG server.";
}
leaf name {
type string;
description
"The unique name of SYSLOG server.";
}
leaf transport-protocol {
type enumeration {
enum "udp";
enum "tcp";
}
default "udp";
description
"Transport protocol type used for connection towards SYSLOG server.";
}
leaf port {
type uint16;
default 514;
description
"Port used for connection towards SYSLOG server.";
}
description
"Syslog servers that can be referenced for the syslog configuration under switch templates.";
}
}