#342 - introduce standalone flag
closes #342
changes:
standaloneoption added- prevent module being generated when
standaloneis set - generate and export
provideApiConfiguration(accepting value or factory)
Will this work in case of multiple schemas? I for example have 2 BE services (schemas) and I have to generate 2 different configs, which generate 2 different modules.
Example: ChatApiModule and UserApiModule
Which i then import:
importProvidersFrom([
UserApiModule.forRoot({ rootUrl: USER_SERVICE_ENDPOINT_PREFIX }),
ChatApiModule.forRoot({ rootUrl: CHAT_SERVICE_ENDPOINT_PREFIX }),
]),
Will your solution work in this use case?
yes - it works the same way as module (which defaults to ApiModule).
You need to provide a custom name for the configurationClass
{
"$schema": "../node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
"input": "user-api.yaml",
"module": false,
"configuration": "UserApiConfiguration"
}
{
"$schema": "../node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
"input": "chat-api.yaml",
"module": false,
"configuration": "ChatApiConfiguration"
}
then you can use it like
bootstrapApplication(AppComponent, {
providers: [
provideUserApiConfiguration({ rootUrl: USER_SERVICE_ENDPOINT_PREFIX }),
provideChatApiConfiguration({ rootUrl: CHAT_SERVICE_ENDPOINT_PREFIX }),
]
})
@luisfpg, is there anything I can do to help expedite this PR? We're very much looking forward to seeing this option being implemented.
Any updates?
I've tested this. Looks great!
@mumenthalers I see there are some conflicts to resolve now. I hope this can be merged soon. 🤞