mtrajano / laravel-swagger

Auto generates the swagger documentation of a laravel project based on best practices and simple assumptions
167 stars 71 forks source link

Documentation generation for response types #13

Closed harikk closed 4 years ago

harikk commented 4 years ago

Hello, I like the feature of automatically generating request structure from the request parameters in Laravel routes. But I am not able to generate response structure. Is there any configuration for this? eg:

  public function login(LoginRequest $request)
  {
    // some code
    return response()->json([
              'access_token' => $accessToken,
              'token_type' => 'Bearer',
              'scopes' => $scopes,
              'expires_at' => $tokenResult->token->expires_at->timestamp
          ])
  } 

This call is generating

           "responses": {
                "200": {
                    "description": "OK"
                }
            },

But how can I generate the actual response structure? It would be very helpful because then I can use this json to generate code for my Angular front end.

mtrajano commented 4 years ago

My goal with this package was to generate a swagger file with no or minimal configuration. Unfortunately this would be very hard to do without having a bunch of custom phpdoc annotations. If you have any idea how to do this without adding a ton of custom configuration please file a feature request with more info or a pr, thank you!