hey-api / openapi-ts

✨ Turn your OpenAPI specification into a beautiful TypeScript client
https://heyapi.vercel.app
MIT License
640 stars 45 forks source link

Proper Angular support #667

Open mightymatth opened 3 weeks ago

mightymatth commented 3 weeks ago

Description

It seems like Angular module compatibility has been broken after forking openapi-typescript-codegen. Previously, we used --name flag to set a module name that would contain all the services, and we could utilize OpenAPI and BaseHttpClient as injection tokens, which is a common way of doing configuration in Angular.

However, when generating the client via code (using createClient and setting UserConfig), there is no way of creating a module, thus not having the ability to use injection tokens at all.

I haven't seen any mentions of that topic in the changelog, so I'm curious if was that made on purpose or by mistake.

Btw. is there any ongoing effort to create an Angular plugin?

mrlubos commented 3 weeks ago

@mightymatth Can you share your config?

mightymatth commented 2 weeks ago

My config is irrelevant in this context. I'm just asking why name property is deprecated in ClientConfig. If something is deprecated, it should be noted what to use instead. If I understood the idea, you're making separate libraries for each client, and only in that case, name is deprecated.

So, can we still use name if using a legacy Angular client?