vitess-operator
vitess-operator copied to clipboard
docs/api: Links for status map types are broken
In the generated docs, links for map types like map[string]*planetscale.dev/vitess-operator/pkg/apis/planetscale/v2.VitessClusterCellStatus are broken. We probably need to contribute a patch to the gen-crd-api-reference-docs tool we use, to teach it to handle maps of custom types, which is somewhat non-standard (though we only do it in status types).
@enisoc Would like to work on this. Can this be assigned to me? But I need your nelp.
I'm not exactly sure what it would take to fix this, but I can elaborate on the problem.
In our VitessClusterStatus object, we have a field called cells that is of type map[string]*VitessClusterCellStatus. Clicking on the type for this field should take you to the docs for the VitessClusterCellStatus struct, since that's the important part.
However, the link is generated as:
#planetscale.com/v2.*planetscale.dev/vitess-operator/pkg/apis/planetscale/v2.VitessClusterCellStatus
When we actually need it to be generated as:
#planetscale.com/v2.VitessClusterCellStatus
We have some rules in the generator config that are supposed to do this mapping, but I couldn't get them to work for map types - only for slices:
https://github.com/planetscale/vitess-operator/blob/69c9486f6c5877e707a7b3d4077c2626a731f60d/docs/api/config.json#L23-L28
I suspect we might have to contribute a patch to the generator itself (https://github.com/ahmetb/gen-crd-api-reference-docs) to make these rules work for maps.