freeflowuniverse / crystallib

Apache License 2.0
9 stars 3 forks source link

Openrpc cli doc generator generates weird doc #171

Closed DylanVerstraete closed 1 year ago

DylanVerstraete commented 1 year ago

Example 1

function with docline:

// loads a new eth client
pub fn (mut e EthClient) load(args Load) ! {
    _ := e.client.send_json_rpc[[]Load, string]('eth.Load', [args], eth.default_timeout)!
}

generates:

  "methods": [
    {
      "name": "eth.Load",
      "description": "s a new eth client",

so it cuts the "load" from "loads" and uses the remaining for docstring.

Example 2

function with docline:

// balance returns eth balance for the given address.
pub fn (mut e EthClient) balance(address string) !string {
    return e.client.send_json_rpc[[]string, string]('eth.Balance', [address], eth.default_timeout)!
}

generates:

    {
      "name": "eth.Balance",
      "description": " returns eth balance for the given address.",

here it cuts the "balance" from the docstring but also leaves and empty space

timurgordon commented 1 year ago

in example 2 is it ok if it cuts balance with the whitespace? This trimming was done to keep the description concise. In V's documentation guidelines it states "The comment must start with the name of the definition." I can also just get rid of the trimming if you think its unnecessary.

DylanVerstraete commented 1 year ago

If the comment starts with the name of the function (which is indeed good practice) it should trim the leading whitespace imo