Closed
Description
Suggestion
This is a follow-up story for #4258, after creating the oai enhancer service as extension point, we should add the service in @loopback/rest
module so that other enhancers could register and contribute OpenAPI specs into the application(server).
Use Cases
Inside function getApiSpec()
, you can apply an enhancer like:
getApiSpec (requestContext?: RequestContext): OpenApiSpec {
// ...other code
spec = this.OAIEnhancer.applyEnhancerByName('authorization-bearer');
}
Examples
Same as use cases
Acceptance criteria
-
add an
OASEnhancerService
in the rest server, as how it has other properties like_requestHandler
. -
add tests for registering and invoking enhancers
-
(Stretch Goal, feel free to open new stories)if any existing spec contribution code in https://github.com/strongloop/loopback-next/blob/master/packages/rest/src/rest.server.ts#L702 should be organized into enhancers, then refactor them into enhancers