verida / verida-js

The Verida SDK provides several SDKs to interact with the Verida Network
https://developers.verida.network
ISC License
1.32k stars 38 forks source link

Optimise API documentation generation #350

Open aurelticot opened 11 months ago

aurelticot commented 11 months ago

API References Documentation

Tests

Testing API references doc generation with different options

missing exports plugin true true true true false false
excludeExternals false true false false false true
excludePrivate false false true false false true
excludeInternal false false false true - -
Nb files 1121 551 1121 1121 150 150
Nb classes 223 67 67 67 27 27
Nb enums 36 32 32 32 7 7
Nb interfaces 814 412 412 412 92 92
Nb modules 45 37 37 37 21 21
Has missing Verida Probably not Probably not Probably not Probably not Probably Probably
Has non-Verida Yes Apparently not Yes Yes No No
Has duplicates Yes Yes Yes Yes Probably not Probably not
Has linked references No No No No No No
Comment Nothing annotated as @internal anyway

Problems

Documentation missing Verida entities

The plugin typedoc-plugin-missing-exports generates the documentation of "internal" entities (entities that are not exported by the entry points of the library src/index.ts). These entities are marked as “Internal” in the documentation. This plugin has the drawback to basically generate the doc of everything it finds.

As there are useful entities, needed by the developer, which should be documented but are currently not exported by the entry points.

Example the constructor of the Client class takes a userConfig parameter of type ClientConfig, this type is not exported but it would be useful for building the client config in a variable on the side.

If we properly export the needed types, we would not need this plugin.

No resolution of the reference and Duplicates

As a monorepo, entities are exported by modules and imported by others.

The documentation of the consuming module should reference the entity from its original module (having a link to the corresponding file). But it’s not the case, it’s actually creating duplicates in its own module documentation and linking these duplicates instead.

Note that without the plugin missing-exports there are no such duplicates, but there is no link to the referenced entity, which is very annoying.

typedoc needs a specific configuration in monorepo, and consolidate all the package docs to resolve who consume what.

Recommendations

nick-verida commented 4 months ago

Is there any progress on this? Probably need to sort it before putting the API docs up somewhere