Caddy module docs not getting generated

I registered my Caddy package a few days ago, but the documentation pages for my package’s modules (app, handler) are blank. How do I get these populated?

A previous post had a similar issue. There, they needed to add JSON tags to their module’s struct fields, but I have these already. It feels like I’m overlooking something here. What am I missing?

Thanks!

I see this in our logs

dereference failed, type not found: github.com/liujed/goutil/optionals.Optional[github.com/caddyserver/caddy/v2.Duration]@v0.0.0**strong text**

I guess our documentation parser doesn’t like the use of generics :confused: Sorry, we’re behind in updating the doc generation engine.

1 Like

Thanks for the quick response!

Ah, I see. The situation is even more complex, because an Optional[T] serializes to JSON like a *T, which the documentation parser would have a hard time figuring out.

To address this, I’ll avoid using generics and types with custom JSON marshalling in my Caddy module structs.

Edit: worth noting that this applies to all types reachable from the Caddy module struct, including fields tagged with json:"-".

2 Likes

On a whim, I’m looking at caddyserver/moduledoc to see how much effort it would be to add support for generics. Can you tell me where the Storage implementations are kept? I’ve searched the caddyserver GitHub org for “GetTypeByName” and I’m just seeing the interface and calls in the moduledoc repository.

Okay, I see now that the Storage implementations are probably in the closed-source part of the website: Building website with custom module docs · Issue #384 · caddyserver/website · GitHub

Yeah, I guess the package version of the Go parser we’re using doesn’t support newer syntaxes.