Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Show the correct warning when user creates an action with a relative URI #350

Closed
JefStat opened this issue Jun 27, 2016 · 4 comments
Closed
Labels

Comments

@JefStat
Copy link

JefStat commented Jun 27, 2016

# Group Reports

## Reports [/reports]

### Add report to digest [PUT {id}/subscribe]

+ Parameters
    + id: h89h9h23 (required, string) - Id of the report

Follow error is returned for this snippet
parameter 'id' not specified in 'Reports' its '/reports' URI template

@JefStat JefStat changed the title Starting a url relative url template with a parameter returns an error Starting a relative url template with a parameter returns an error Jun 27, 2016
@kylef kylef added the bug label Jun 27, 2016
@zdne
Copy link
Contributor

zdne commented Jun 28, 2016

Designer's note: This was never intended in the API Blueprint. The URL (template) of an action should be relative to the API's root not to the parent resource.

@kylef
Copy link
Member

kylef commented Jun 28, 2016

That's right, the paths for actions are not relative to the resource. I'm saying the validation warning being emitted is a bug.

The following two warnings are emitted when reproducing this problem. The warning is implying the API Blueprint parser is trying to apply the actions parameters to the resource URI and they are not there. This should not be the case.

warning: (8)  parameter 'username' not specified in 'Users' its '/users' URI template :52:44
warning: (5)  ignoring unrecognized block :96:15

Example blueprint:

## Users [/users]
### View a User [GET {username}]

+ Parameters
    + username: kyle (string)

+ Response 204

I guess, the correct warning should read that the path should include a forward slash at the start of the URI.


@JefStat You can take the above into account and change your URI for your action to be absolute and become /reports/{id}/subscribe to resolve this warning.

@JefStat
Copy link
Author

JefStat commented Jun 28, 2016

Thanks @kylef I have done that.

@kylef kylef changed the title Starting a relative url template with a parameter returns an error Show the correct warning when user creates an action with a relative URI Jun 30, 2016
@kylef
Copy link
Member

kylef commented Oct 12, 2016

This has now been done.

The parser will show the following warning:

warning: (12)  URI path in 'View a User [GET {username}]' is not absolute, it should have a leading forward slash :18:34

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants