-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
Description
Describe the bug
Incorrect methods names when using typescript client generator on a schema that has dots in method names.
To Reproduce
Steps to reproduce the behavior:
- run
npm install -g @open-rpc/generator
- Create file
openrpc.json
with the following content using dots in method names:
{
"openrpc": "1.0.0-rc1",
"info": {
"title": "test",
"version": "1.0.0"
},
"methods": [
{
"name": "foo.bar",
"summary": "test",
"params": [],
"result": {
"name": "fooBarResult",
"schema": {
"type": "object"
}
}
}
]
}
- run
open-rpc-generator generate -t client -l typescript -n test-d ./openrpc.json -o ./generated
- go to
./generated/client/typescript/src/index.ts
- See typescript error on line 153 due to incorrect syntax.
public foo.bar: FooBar = (...params) => {
return this.request("foo.bar", params);
}
Expected behavior
Dot replaced with '_' (or somehow removed, like fooBar
) for typescript method name:
public foo_bar: FooBar = (...params) => {
return this.request("foo.bar", params);
}
Desktop
- OS: Windows 10
@open-rpc/generator
version^1.18.11