1

NelmioApiDoc v2 allowed to use multiple views parameter so I can hide some endpoints and present them on different URL

https://symfony.com/doc/current/bundles/NelmioApiDocBundle/multiple-api-doc.html

Is it possible to do it in NelmioApiDoc v3 which is using Swagger?

I am using Symfony 3.3

breq
  • 24,412
  • 26
  • 65
  • 106

1 Answers1

1

What you are looking for seems to be called "Areas" now in NelmioApiDoc v3. Thanks to this feature, you can define areas which will each generates a different documentation :

You just have to define those areas in your config.yml:

nelmio_api_doc:
    areas:
        default:
            path_patterns: [ ^/api ]
        custom:
            path_patterns: [ ^/custom ]
        another_custom:
            path_patterns: [ ^/anothercustom ]

Then you need to update your routing.yml file:

app.swagger_ui:
    path: /api/doc/{area}
    methods: GET
    defaults: { _controller: nelmio_api_doc.controller.swagger_ui, area: default }

You can read about it on this doc.

bhalexx
  • 26
  • 6
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/18691857) – Prashant Tukadiya Feb 01 '18 at 13:20
  • @Prashant Tukadiya: understood! I edited my answer ;) – bhalexx Feb 01 '18 at 15:03
  • I think I can accept your answer now. V3.1 is now published – breq Feb 02 '18 at 09:37