In https://github.com/aaronpowell/azure-functions-nodejs-openapi/blob/main/src/openAPIv3.ts#L29 (generateOpenApiSpec), the whole context.res is getting overwritten with an object containing only the response body. This makes it impossible to prepare custom response headers (for example CORS) by wrapping the function in another higher level function.
I propose that generateOpenApiSpec surgically inserts the response body instead of nuking the whole response object.
Another solution could be to accept an option which sets CORS headers as requested, but this is less flexible.
In https://github.com/aaronpowell/azure-functions-nodejs-openapi/blob/main/src/openAPIv3.ts#L29 (generateOpenApiSpec), the whole
context.resis getting overwritten with an object containing only the response body. This makes it impossible to prepare custom response headers (for example CORS) by wrapping the function in another higher level function.I propose that
generateOpenApiSpecsurgically inserts the response body instead of nuking the whole response object.Another solution could be to accept an option which sets CORS headers as requested, but this is less flexible.