Category : nelmioapidocbundle

I’m using Symfony (5) with NelmioApiDocBundle (4.0) and LexikJWTAuthenticationBundle to create an API with Swagger. I’ve set up endpoints and authentication and everything is working as expected. I have fully functional API with authentication, there is a documentation and I can successfully generate Open API spec. There is one thing missing in specification: "Authentication endpoint" ..

Read more

I have a simple controller and want to document it with Nelmio, I follow the documentation to install the package. Here is my controller: […] use SymfonyComponentRoutingAnnotationRoute; use NelmioApiDocBundleAnnotationApiDoc as Doc; /** * @Route("/api/candidates") */ class CandidateController extends AbstractController { /** * List the candidates * @ Route("/", name="candidate_list", methods={"GET"}) * @DocApiDoc( * resource=true, * ..

Read more

I try to configure nelmio/api-doc-bundle to use Authorization header for my Bearer token. I configure it in nelmio_api_doc.yaml like this nelmio_api_doc: documentation: info: title: title version: 1.0.0 securityDefinitions: Bearer: type: apiKey description: ‘jwt from oauth prefixed by `Bearer`’ name: Authorization in: header security: – Bearer: [] areas: # to filter documented areas path_patterns: – ^/api(?!/doc$|/doc.json$) ..

Read more

I am trying to use shared obejcts for my documentation but It does not appear to work. Based on nelmio decumentation I did the following: On my serailizer: /** * @OASchema( * @OAProperty(property="id", type="string", example="00000000-0000-0000-0000-000000000000"), * @OAProperty(property="email", type="string", example="[email protected]"), * @OAProperty(property="status", type="string", example="active"), * @OAProperty(property="roles", type="array", [email protected](type="string"), example={"ROLE_USER", "ROLE_ADMIN"}), * ) */ class AdminUserTransformer extends ..

Read more

I’m currently generating OpenAPI annotations via Symfony (5.1) Routes and NelmioApiDocBundle, One of the routes looks like this: * @Route("/users/{id}", methods={"GET"}, requirements={"id": "d+"}) * @OAParameter(name="id", in="path", description="The id of the user", required=true, @OASchema(type="integer")) and another like * @Route("/users/followed", methods={"GET"}) I’m using the League’s OpenAPI PSR-7 Message Validator (https://github.com/thephpleague/openapi-psr7-validator) by converting the Symfony Request to a ..

Read more