With oto 0.11.0, TypeScript definitions with objects are wrong
opened this issue · comments
With the following API definition and the client.ts.plush
template from the otohttp project, we get wrong TypeScript output. This can be reproduced with the current version, v0.11.0, but was not occurring with an older version, in my case v.0.10.14.
package definitions
type SessionService interface {
UpdateSession(UpdateSessionRequest) UpdateSessionResponse
}
type UpdateSessionRequest struct { Customer *Customer }
type UpdateSessionResponse struct {}
type Customer struct {}
The wrong TypeScript code:
// removed for brevity
export class UpdateSessionRequest {
constructor(data?: any) {
if (data) {
this.customer = new *Customer(data.customer);
}
}
customer?: *Customer;
}
// removed for brevity
Noticing the star before the Customer
? That's causing syntax errors.
@nachtjasmin thanks for reporting this. I've updated the template with a fix, can you try it and let me know if that works?