Apidoc: multiple types in @apiParam

Created on 20 Feb 2015  路  28Comments  路  Source: apidoc/apidoc

I use apiDoc for documenting JavaScript and would like to use @apiParam to show that an input parameter can be of different types. For example:

/**
 * @apiParam {Object|Number} options an options object or just a number
 */
function myFunc(options) {
}

Unfortunately, the above example gives an error in the parser:

error: Empty parser result. 
{ File: 'myfile.js',
  Block: 1,
  Element: '@apiParam',
  Source: '@apiParam {Object|Number} ..'
}

Is there a character other than the pipe that does not blow the parser? Or is there a way to escape the pipe character? Thanks!

think about

Most helpful comment

Same request for @apiResponse :)

@apiSuccess {string|integer|null} field Description

All 28 comments

Currently name them mixed and add a description.
I check to allow this feature again, it was removed because of the the size and allowedValues parameters that can be added to a type.

Same request for @apiResponse :)

@apiSuccess {string|integer|null} field Description

This would be nice, but something else that might be easier is to simply allow listing the same parameter more than once:

@apiParam {String} [Resources] A Resource label 
@apiParam {String[]} [Resources] A list of Resource labels

Right now this just lists the last one and ignores the first.

Hi, can file type param be supported in @apiParam ?

@apiParam {File} [Resources] A Resource File to be uploaded

Thanks.

I have something to add to this conversation.
I'm trying to document a Java API and one of my @apiParams has a type of Set<Integer>
However apidoc throws an error because of the special characters: < >
Any tips or fixes?
&lt; &gt; doesn't work either.

+1 on this, this seems pretty critical

+1
I'm getting the same problem trying to document a C# class:
error: Empty parser result.
{ File: '.\\GoalsV2Module.cs', Block: 4, Element: '@apiSuccess', Source: '@apiSuccess (200) {Nullable&lt;int&gt;} goal.IntegrationId' }

Also it doesn't work with characters like: ? | ... etc

+1 pretty basic

any news here?

any news ?

+1

Still waiting for this :)

How is the status for file type param?

+1

+1

+1

+1

+1

For a temporary solution se #573

+1

+1

+1

+1

+1

+1

+1

+1

The {String|Number} syntax works now.

Was this page helpful?
0 / 5 - 0 ratings