palantir / conjure-typescript

Conjure generator for TypeScript clients
Apache License 2.0
17 stars 16 forks source link

Conjure doesn't escape argument names in TypeScript APIs #129

Open eduardische opened 4 years ago

eduardische commented 4 years ago

What happened?

I defined the following endpoint in Conjure:

testTypeScript:
  http: GET /test
  args:
    function:
      type: string
      param-id: Function
      param-type: header
  returns: string

The API works, but when trying to generate TypeScript for this API, it fails to compile it with the following two lines using function as parameter name at fault:

testTypeScript(function: string): Promise<string>;
...
public testTypeScript(function: string): Promise<string> {

I depend on 4.0.0:

com.palantir.conjure.typescript:conjure-typescript = 4.0.0

What did you want to happen?

Parameter name should be escaped or prefixed, since it's a reserved keyword in TypeScript.

eduardische commented 4 years ago

Hit this issue another time on 4.1.0 with name delete now.