documentationjs / documentationjs/documentation

Document inherited members as instance members

Open
#390 5 comments 5 reactions 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

Hello,
I've a lot of classes, representing all my resources, like

Product.es6.js

```
import BaseResource from './../BaseResource'
export default class Product extends BaseResource {
constructor(self) {
super(self)
this.path = 'product'
}
aMethod(a = 1) {
return a;
}
}
```

```
export default class BaseResource {
retrieve(id) {
return something;
}
}
```

The `Product` class extends the `BaseResource` class that contains all the commons methods.

What I'd like to do is to document all the members of Product and of the others resource classes as if it were instanced, for example, I'd like that documentation.js will output something like that:

---
## product.retrieve

Retrieve a single resource by id or a set of resources

**Parameters**
- `id` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=** id of the resource to retrieve (optional, default `undefined`)

**Examples**

``` javascript
var client = new Client()
var listOfProducts = client.product.retrieve()
var singleProduct = client.product.retrieve(10)
```
## product.aMethod

Retrieve something else

**Parameters**
- `a` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=** id of the resource to retrieve (optional, default `undefined`)
## anotherResourceThatExtendsBaseResource.retrieve

Retrieve something else

**Parameters**
- `id` **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)=** id of the resource to retrieve (optional, default `undefined`)

**Examples**

``` javascript
var client = new Client()
var listOfProducts = client.product.retrieve()
var singleProduct = client.product.retrieve(10)
```
# TL;DR

All I want to do is to prefix the method name with the super class name.
And, if it is possible, to override only the description of the method in the super class.

`product.retrieve` and `anotherResourceThatExtendsBaseResource.retrieve` are the same method, but different classes, so I'd like to override the description of the method

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.