From f7fc2353909301c0d8cc2e2d9ee0b13e7feb156e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sedl=C3=A1=C4=8Dek?= Date: Tue, 6 Jan 2026 13:07:52 +0100 Subject: [PATCH 1/2] succint method arguments --- _examples/e1.ridl | 2 ++ formatter/processor.go | 11 +++++++---- main_test.go | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/_examples/e1.ridl b/_examples/e1.ridl index 5e18a09..6632326 100755 --- a/_examples/e1.ridl +++ b/_examples/e1.ridl @@ -83,3 +83,5 @@ service ExampleService # oof -stream Se ndAndRecv(req: string) => stream (resp: string) -streamSe ndAndRecv(req: string) => stream (resp: string) + +- Updat eU ser ( User ) => ( User , ok : bool ) diff --git a/formatter/processor.go b/formatter/processor.go index ddbaa9a..a342685 100644 --- a/formatter/processor.go +++ b/formatter/processor.go @@ -421,11 +421,14 @@ func formatMethodArguments(s string) (string, error) { args := splitArguments(content) for i, a := range args { p := strings.Split(a, ":") - if len(p) != 2 { - return "", fmt.Errorf("missing ':' in arguments for method") + switch len(p) { + case 1: + args[i] = p[0] + case 2: + args[i] = fmt.Sprintf("%s: %s", p[0], p[1]) + default: + return "", fmt.Errorf("wrong parameter values") } - - args[i] = fmt.Sprintf("%s: %s", p[0], p[1]) } return strings.Join(args, ", "), nil diff --git a/main_test.go b/main_test.go index 769d511..723c450 100644 --- a/main_test.go +++ b/main_test.go @@ -162,6 +162,7 @@ service ExampleService # oof @public - GetUser ( header : map < string , string > , userID : uint64 ) => ( code : uint32 , user : User ) - FindUser(s :SearchFilter) => (name: string, user: User) ###! last + - Updat eU ser ( User , really : bool ) => ( User , ok : bool ) - stream Re cv (req : string ) @@ -255,6 +256,7 @@ service ExampleService # oof @public - GetUser(header: map, userID: uint64) => (code: uint32, user: User) - FindUser(s: SearchFilter) => (name: string, user: User) ###! last + - UpdateUser(User, really: bool) => (User, ok: bool) - stream Recv(req: string) From 65f150f7f79dbe186457b6d893c9c7062c5aa5ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Sedl=C3=A1=C4=8Dek?= Date: Tue, 6 Jan 2026 13:13:06 +0100 Subject: [PATCH 2/2] succint with just one argument --- _examples/e1.ridl | 2 +- main_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_examples/e1.ridl b/_examples/e1.ridl index 6632326..b6fe36a 100755 --- a/_examples/e1.ridl +++ b/_examples/e1.ridl @@ -84,4 +84,4 @@ service ExampleService # oof -stream Se ndAndRecv(req: string) => stream (resp: string) -streamSe ndAndRecv(req: string) => stream (resp: string) -- Updat eU ser ( User ) => ( User , ok : bool ) +- Updat eU ser ( User ) => ( User ) diff --git a/main_test.go b/main_test.go index 723c450..927e26e 100644 --- a/main_test.go +++ b/main_test.go @@ -162,7 +162,7 @@ service ExampleService # oof @public - GetUser ( header : map < string , string > , userID : uint64 ) => ( code : uint32 , user : User ) - FindUser(s :SearchFilter) => (name: string, user: User) ###! last - - Updat eU ser ( User , really : bool ) => ( User , ok : bool ) + - Updat eU ser ( User ) => ( User ) - stream Re cv (req : string ) @@ -256,7 +256,7 @@ service ExampleService # oof @public - GetUser(header: map, userID: uint64) => (code: uint32, user: User) - FindUser(s: SearchFilter) => (name: string, user: User) ###! last - - UpdateUser(User, really: bool) => (User, ok: bool) + - UpdateUser(User) => (User) - stream Recv(req: string)