dingo / dingo/api

blueprint - api:docs - route groups wrong paths

Open
#1,491 3 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

Hello, I am trying to group my API doc routes like

user/login
user/me
user/...

Here is my Controller with annonations

```
/**
* @Resource("User", uri="/user")
*/
class AuthController extends Controller
{
```

```
/**
* Login user
*
* Login with a `username` and `password`.
*
* @Post("login")
* @Versions({"v1"})
* @Transaction({
* @Request({"email"="foo", "password"="bar"}, contentType="application/json"),
* @Response(200, body={"access_token":"token","token_type":"bearer","expires_in":3600}),
* @Response(401, body={"error":{"code":103,"message":"Email or password is incorrect."}})
* })
*/
public function login(Request $request)
{
```

When I am using Resource with uri=, docs is creating wrong paths for methods, or I dont know how to use blueprint annotations. And same thing is happening if I try to convert blueprint > postman dump with apiary2postman.

[https://image.prntscr.com/image/xJq79Cr3RsKZxNSaroMYPQ.png](https://image.prntscr.com/image/xJq79Cr3RsKZxNSaroMYPQ.png)

And generated bluprint file :

```
FORMAT: 1A

# docTest

# User [/user]

## Login user [POST /user/login]
Login with a `username` and `password`.

+ Request (application/json)
+ Body

{
"email": "foo",
"password": "bar"
}

+ Response 200 (application/json)
+ Body

{
"access_token": "token",
"token_type": "bearer",
"expires_in": 3600
}

+ Response 401 (application/json)
+ Body

{
"error": {
"code": 103,
"message": "Email or password is incorrect."
}
}

## Get current user [POST /user/me]
Get user with token.

+ Request (application/json)
+ Body

{
"email": "foo",
"password": "bar"
}

+ Response 200 (application/json)
+ Body

{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOi8vbG9jYWxob3N0Ojg4OC9hcGkvdXNlci9sb2dpbiIsImlhdCI6MTUxMjQ5NjM1OCwiZXhwIjoxNTEyNDk5OTU4LCJuYmYiOjE1MTI0OTYzNTgsImp0aSI6ImZJd1BmTkVZc1FRNTROYmIiLCJzdWIiOjUsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.Eh-oQ8MpK1rrbpwqeOnoouIASkdGOKijzgGVjxTyy9s",
"token_type": "bearer",
"expires_in": 3600
}

+ Response 401 (application/json)
+ Body

{
"error": {
"code": 103,
"message": "Email or password is incorrect."
}
}
```

Thanks !!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.