phpswaggernelmioapidocbundle

PHP Swagger - path at area level


How do I specify paths at the area level?

Currently I have this:

paths:
      /internal_api/token/refresh:
        post:
          tags:
            - Auth
...
areas:
      default:
          path_patterns: 
              - ^/api(?!/doc$)(?!/doc/)(?!/.+/audit/) 
      internal:
          path_patterns: 
              - ^/internal\_api(?!/doc$)(?!/.+/audit/) 

I don't want the refresh token path appear for public api docs. Tried to move path under area but it didn't work.

I tried moved a path under area but got an error.


Solution

  • You can add documentation fields per area:

    nelmio_api_doc:
        areas:
            default:
                path_patterns: 
                    - ^/api(?!/doc$)(?!/doc/)(?!/.+/audit/) 
            internal:
               documentation:
                   paths:
                       /internal_api/token/refresh:
                           post:
                                tags:
                                     - Auth
    
               path_patterns: 
                    - ^/internal\_api(?!/doc$)(?!/.+/audit/)