apidoc/apidoc-core

@apiUse inside other blocks

caseycrites opened this issue · 1 comments

I apologize for the slightly ambiguous title, but let me explain what I'm after. I'd basically like to use @apiDefine to define blocks of JSON for different models inside my API, and then @apiUse them inside @apiSuccessExample blocks, so I don't have to repeat them multiple times but can still change things like the response code, or place those objects inside arrays, etc.. For example, this is what I'd imagine:

###
@apiDefine ModelJSON
{
  "hey": "you",
  "look": "here"
}
###

###
@apiSuccessExample {json} Success
  HTTP/1.1 200 OK
  [
    @apiUse ModelJSON,
    @apiUse ModelJSON
  ]
###
getAll: (req, res) ->
  res.send('hey')

###
@apiSuccessExample {json} Success
  HTTP/1.1 200 OK
  @apiUse ModelJSON
###
getOne: (req, res) ->
  res.send('hey')

###
@apiSuccessExample {json} Success
  HTTP/1.1 201 OK
  @apiUse ModelJSON
###
post: (req, res) ->
  res.send('you')

Is there a way to currently do this? or would this require creating a new tag in order to support?

apiDefine and apiUse are not designed to be used inside an annotation.
Currently i proof to add a link or an include tag for file import for this usecase (e.g. for bigger examples), but it is not implemented yet.