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
asyncapi-codegen/pkg/utils/template/helpers.go
Line 66 in 59071bb
go: downloading github.com/lerenn/asyncapi-codegen v0.41.3 panic: runtime error: slice bounds out of range [:1] with length 0 goroutine 1 [running]: github.com/lerenn/asyncapi-codegen/pkg/utils/template.DefaultNamifier({0x10331f418, 0x1}) /Users/nickchen/go/pkg/mod/github.com/lerenn/[email protected]/pkg/utils/template/helpers.go:66 +0x30c github.com/lerenn/asyncapi-codegen/pkg/utils/template.Namify(...)
go run github.com/lerenn/asyncapi-codegen/cmd/asyncapi-codegen@main -i api/ws/dxfeed/asyncapi.yaml -o ./test.gen.go -g types
Propose fix:
diff --git a/pkg/utils/template/helpers.go b/pkg/utils/template/helpers.go index 0d5c21c..2491a2e 100644 --- a/pkg/utils/template/helpers.go +++ b/pkg/utils/template/helpers.go @@ -61,7 +61,9 @@ func DefaultNamifier(sentence string) string { // Remove leading numbers re = regexp.MustCompile("^[0-9]+") sentence = string(re.ReplaceAll([]byte(sentence), []byte(""))) - + if len(sentence) == 0 { + return sentence + } // Upper first letter sentence = strings.ToUpper(sentence[:1]) + sentence[1:]
The text was updated successfully, but these errors were encountered:
Hello @nickchen ! Thanks for reporting this bug ! The fix looks great !
I can create the MR and merge it for you, but if you prefer to do it and be credited in the Github contributors, let me know !
Sorry, something went wrong.
#236 here you go. Ran into couple of other issues, will open separate PR for them.
Thanks for opening those issues/PR. It's really helpful for the project :)
I'll close this issue, as you solved it in a now merged PR.
lerenn
No branches or pull requests
asyncapi-codegen/pkg/utils/template/helpers.go
Line 66 in 59071bb
go run github.com/lerenn/asyncapi-codegen/cmd/asyncapi-codegen@main -i api/ws/dxfeed/asyncapi.yaml -o ./test.gen.go -g types
Propose fix:
The text was updated successfully, but these errors were encountered: