dingo / dingo/api

Always getting "No HTTP method given, invalid API blueprint."

Open
#1,215 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

I'm always getting the following error when trying to generate docs:

```
[RuntimeException]
No HTTP method given, invalid API blueprint.
```

This is the command I run:

```
php artisan api:docs --output-file docs.md
```

And this is the controller that I have

``` php
manager = $manager;

parent::__construct($request, $app);
}

/**
* Login method
*
* @return \Dingo\Api\Http\Response
*
* @Get("/")
*/
public function login()
{
$credentials = $this->request->only('email', 'password');

$token = $this->manager->login($credentials);
$response = $this->response->array($token);

return $response;
}

/**
* Register method
*
* @return \Dingo\Api\Http\Response
*
* @Get("/")
*/
public function register()
{
$credentials = $this->request->only('email', 'password', 'name');

$user = $this->manager->register($credentials);
$location = route('users.me');
$response = $this->response
->item($user, new UserTransformer, [
'key' => 'users',
])
->setStatusCode(201)
->withHeader('Location', $location);

return $response;
}
}
```

I have some other controllers that are not documented.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with `php artisan api:docs --output-file docs.md` and inspect the annotations shown in AuthController, especially the documented methods. Determine why the generator reports that no HTTP method was given, then verify that documentation generation completes and includes the intended controller endpoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
api, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.