Skip to content

Commit

Permalink
fix: provide a better error if go verb isn't upper camel case (#1783)
Browse files Browse the repository at this point in the history
Fixes #1742
  • Loading branch information
safeer authored Jun 14, 2024
1 parent c312807 commit 323cff4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions go-runtime/compile/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,11 @@ func visitFuncDecl(pctx *parseContext, node *ast.FuncDecl) (verb *schema.Verb) {
return nil
}

if expVerbName := strcase.ToUpperCamel(node.Name.Name); node.Name.Name != expVerbName {
pctx.errors.add(errorf(node, "unexpected verb name %q, did you mean to use %q instead?", node.Name.Name, expVerbName))
return nil
}

for _, name := range pctx.nativeNames {
if name == node.Name.Name {
pctx.errors.add(noEndColumnErrorf(node.Pos(), "duplicate verb name %q", node.Name.Name))
Expand Down

0 comments on commit 323cff4

Please sign in to comment.