ahmetb / gen-crd-api-reference-docs

API Reference Docs generator for Kubernetes CRDs (used by Knative, Kubeflow and others)
Apache License 2.0
307 stars 99 forks source link

Fix display of map types #65

Closed theunrepentantgeek closed 1 year ago

theunrepentantgeek commented 1 year ago

As discussed in #64, the display of map types is incorrect when the value contained by the map is a struct from the local package.

I discovered how typeDisplayName() was failing to simplify the type and modified it to fix the bug by making it mildly recursive.

Background: to debug and fix this problem, I wrote some unit tests that parse a known file and verify the result is expected; this was faster than trying to debug by hand. Unfortunately, these tests rather dominate the PR as they're fairly long (though hopefully straightforward to read.)

If you'd rather a simple PR that contains just the fix for typeDisplayName() then I'm happy to close this unmerged and create a new PR with just that change.

Closes #64

ahmetb commented 1 year ago

A smaller PR would be much preferred thanks.

theunrepentantgeek commented 1 year ago

Done - see #66 for the fix itself.

Would you like me to turn this PR into unit tests alone, or just close it?