dingo / blueprint

Generate valid API Blueprint documentation
271 stars 108 forks source link

@Attributes is not parsed into the bluprint doc #18

Open lightvision opened 8 years ago

lightvision commented 8 years ago

@jasonlewis The "@Attributes" is not parsed into the blueprint documentation upon generation.

I've used the example from the blueprint/tests/Stubs/UserPhotosResourceStub.php

Anyway to solve it? Thanks

jasonlewis commented 8 years ago

What are you seeing exactly? I'll hopefully be able to dedicate some good time to Dingo over the next few days.

tdanielcox commented 8 years ago

Hey Jason, I am also seeing the same thing. I have tried both ways that are shown in the tests:

https://github.com/dingo/blueprint/blob/master/tests/Stubs/UsersResourceStub.php#L55

/**
* Post a channel
*
* Add a new channel
*
* @Post("/")
* @Transaction({
*     @Request(body={
*         "title": "Lorem ipsum dolor...",
*         "description": "Lorem ipsum dolor..."
*     }, attributes={
*         @Attribute("title", type="string", required=true, description="The title of the channel", sample="Lorem ipsum dolor..."),
*         @Attribute("description", type="string", required=false, description="The long description of the channel (max 1000, HTML yes)", sample="Lorem ipsum dolor...")
*     }),
*     @Response(201),
*     @Response(400),
*     @Response(401)
* })
*/

https://github.com/dingo/blueprint/blob/master/tests/Stubs/UserPhotosResourceStub.php#L73

/**
* Post a channel
*
* Add a new channel
*
* @Post("/")
* @Attributes({
*      @Attribute("title", type="string", description="The title of the channel", sample="Lorem ipsum dolor..."),
*      @Attribute("description", type="string", description="The description of the channel", sample="Lorem ipsum dolor...")
* })
* @Transaction({
*     @Response(201),
*     @Response(400),
*     @Response(401)
* })
*/

I am not seeing the Attributes being generated using either method. Also, there is not documentation for Attribute (at least that I have seen)

I get this error when adding attributes to the @Request object:

The annotation @Request declared on method [...] does not have a property named "attributes". Available properties: body, contentType, identifier, headers

No errors are thrown when adding attributes to the @Attributes object, however no attributes are generated.

Hope this helps.

lightvision commented 8 years ago

@jasonlewis The problem is that even the dingo/api is updated to the latest version is not getting the latest version of dingo/blueprint available on github. I had to clone dingo/blueprint inside my vendor folder to override the dingo/blueprint package in order to make that annotations to work.

Off-topic: It should be nice to have the output file for generated documentation available in config too. I think I will send a PR, there is not much work involved.