Open darius-v opened 5 days ago
Not sure how the issue is related to reusing responses in swagger-php
.
To solve the issue of not being able to use OA\Get
you might have to look into the nelmio bundle. Route
is not a swagger-php
attribute, so perhaps code without a valid Symfony route are ignored?
Not sure how the issue is related to reusing responses in swagger-php.
Just that this example is from reusing responses. I was trying to write code with attributes by this example.
To solve the issue of not being able to use OA\Get you might have to look into the nelmio bundle. Route is not a swagger-php attribute, so perhaps code without a valid Symfony route are ignored?
Maybe. I did not know where to even look at, it is confusing. So as I understand now - examples in swagger-php cookbook are not guaranteed to work when using nelmio api bundle.
But now reading nelmio documentation:
https://symfony.com/bundles/NelmioApiDocBundle/current/index.html#how-does-this-bundle-work
This configuration field can more generally be used to store your documentation as yaml. You may find in the .yaml files from SwaggerPHP examples.
So it points me to swagger php github so probably thats why I expected them to work.
Examples of using the annotations can be found in SwaggerPHP examples.
Example with annotations: https://zircote.github.io/swagger-php/guide/cookbook.html#reusing-responses
Based on the example I have made minimal code. Just added Areas attribute, because in my project without that tag it never shows up. And this does not show up anyway:
If I do this, it works:
So why it does not work as is in documentation? I assume the
@OA\Response(
is not necessary for minimal code. Get attribute by the source I see just extends Get annotation, so it should work. How to debug such cases when there is no error? Maybe I do not know some basics and so do not understand but I have read cookbook.Tried also create dump and when there is no route attribute, and is get instead - there is no such url in the dump.
bin/console nelmio:apidoc:dump > dump.json --area=public