import { apiHide } from './utility' ; import { inject , injectable } from '@loopback/core' ; import { asSpecEnhancer , OASEnhancer , OpenApiSpec } from '@loopback/rest' ; import { OASBindings , OasHiddenApi } from '../keys' ; /**
 * A spec enhancer to modify paths
 */ @ injectable ( asSpecEnhancer ) export class OperationSpecEnhancer implements OASEnhancer { name = 'info' ; constructor ( @ inject ( OASBindings . HiddenEndpoint ) private readonly hidden ) { } modifySpec ( spec ) { const paths = spec . paths ; const arrayApiSearch = Object . entries ( this . hidden ) ; apiHide ( arrayApiSearch , paths ) ; return spec ; } }