Closed prenaissance closed 2 months ago
Hey! What would you expect the resulting code to look like?
Hey! What would you expect the resulting code to look like?
Hello. I would expect the grouped services to be imported instead. The generated services look the following way:
export class MyService {
public static getEp1<
ThrowOnError extends boolean = false,
>(options) {/*...*/}
public static getEp2<
ThrowOnError extends boolean = false,
>(options) {/*...*/}
}
so the import should be:
import {
client,
MyService
} from "../services.gen";
I would expect the static classes to be imported. Instead, the plugin always assumes a flat structure.
@prenaissance Do you expect the TanStack functions to be flat? Grouped?
@mrlubos I don't have a preference about that. The issues is that react-query.gen.ts
imports non-existings functions from services.gen.ts
when the asClass
option is turned on. I can try to make a sandbox example if it's not clear.
No need, that much is clear. Why do you have a preference for using asClass: true but no preference for TanStack functions?
Description
Turning on both
asClass
services and the tanstack query plugin resulting in wrong imports in thereact-query.gen.ts
file:Reproducible example or configuration
OpenAPI specification (optional)
No response
System information (optional)
OS - Ubuntu 22.04 on WSL2, Package manager - pnpm 9.10.0 Node version - 22.9.0 openapi-ts version - 0.53.4 typescript version - 5.6.2