我試圖停用 Swagger UI,或更準(zhǔn)確地說(shuō),因?yàn)槲蚁M覀儍H為非產(chǎn)品環(huán)境提供它。
我引用了此鏈接,但是沒(méi)有任何反應(yīng)。
我的 api_platform.yaml
檔案:
api_platform: defaults: route_prefix: '/%env(API_ROUTE)%' enable_docs: false enable_entrypoint: false enable_swagger_ui: false swagger: api_keys: JWT: name: Authorization type: header collection: pagination: enabled: true
api_platform: defaults: route_prefix: '/%env(API_ROUTE)%' swagger: api_keys: JWT: name: Authorization type: header collection: pagination: enabled: true when@prod: api_platform: enable_docs: false enable_entrypoint: false enable_swagger_ui: false
你的 api_platform.yaml 看起來(lái)像這樣。如果您正確使用環(huán)境,那麼您的 swagger 僅在您的產(chǎn)品環(huán)境中被停用。