Disable Swagger UI on API Platform
P粉176151589
P粉176151589 2024-04-04 17:56:57
0
1
311

I'm trying to disable the Swagger UI, or more precisely, because I want us to provide it only for non-production environments.

I referenced this link, but nothing happened.

My api_platform.yaml File:

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

P粉176151589
P粉176151589

reply all(1)
P粉729436537
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

Your api_platform.yaml will look like this. If you use the environment correctly then your swagger will only be disabled in your production environment.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!