Skip to content

Docs JSON output skips return type for methods without args #12043

Open
@oprypin

Description

@oprypin

For each method, crystal docs --format=json outputs the value args_html.
That value includes both the args and the return value, e.g.
for the method def some_method(name : String) : Int32 and its variations:

  1. "args_html": "(name : String) : Int32"
  2. "args_html": "(name : String)" (missing return value, OK)
  3. "args_html": " : Int32" (method has no args, OK)

However, since #11438 (released in 1.3.0) having no args makes the args_html value totally omitted, so the 3rd case is broken and so https://github.com/mkdocstrings/crystal stopped outputting any return value in such case.

The problematic line:

builder.field "args_html", args_to_html unless args.empty?

Thanks to @Blacksmoke16 who spotted this problem in https://athenaframework.org/ImageSize/#Athena::ImageSize.dpi

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.kind:regressionSomething that used to correctly work but no longer workstopic:tools:docs-generator

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions