I currently have a module that defines a controller with one endpoint. This module is imported by multiple applications to inherit that endpoint. Everything works fine. However, my issue is that I generate Swagger documentation in all of my applications and i would like to adapt the ApiOkResponse for this endpoint depending on the application using it.
My module looks like:
export class MyEndpointModule {
static register(apiReturnSchema: SchemaObject & Partial<ReferenceObject>): DynamicModule {
return {
module: MyEndpointModule,
providers: [
{
provide: 'SCHEMA_TEST',
useValue: apiReturnSchema,
},
...
and i import is as :
MyEndpointModule.register({
oneOf: [
{$ref: getSchemaPath(schema1)},
{$ref: getSchemaPath(schema2)},
]
}),
and the idea was to set the controller of my MyEndpointModule like :
export class MyController {
constructor(
@Inject('SCHEMA_TEST') private schemaTest: SchemaObject & Partial<ReferenceObject>
) {}
@ApiOkResponse({
description: 'blabla',
schema: this.schemaTest,
})
but I can not use this inside a decorator. I'm stuck from this point. How could I solve this?