kubernetes-sigs / reference-docs

Tools to build reference documentation for Kubernetes APIs and CLIs.
Apache License 2.0
88 stars 104 forks source link

Look through AdditionalProperties for references #375

Closed dims closed 3 weeks ago

dims commented 4 weeks ago

Running make api ends up with the following error:

----------------------------------
Orphaned Definitions:
[resource.v1alpha3.DeviceAttribute]
panic: Orphaned definitions found.

goroutine 1 [running]:
github.com/kubernetes-sigs/reference-docs/gen-apidocs/generators.PrintInfo(0x1400029fc38?)
        /Users/davanum/go/src/sigs.k8s.io/reference-docs/gen-apidocs/generators/util.go:47 +0x4d8
github.com/kubernetes-sigs/reference-docs/gen-apidocs/generators.GenerateFiles()
        /Users/davanum/go/src/sigs.k8s.io/reference-docs/gen-apidocs/generators/writer.go:56 +0x70
main.main()
        /Users/davanum/go/src/sigs.k8s.io/reference-docs/gen-apidocs/main.go:28 +0x64
exit status 2
make: *** [api] Error 1

If you look at the definition: https://github.com/kubernetes/kubernetes/blob/8db6fc7e3fabc00f12be17d5a1623cba278d4b6b/api/openapi-spec/v3/apis__resource.k8s.io__v1alpha3_openapi.json#L115-L140

The resource.v1alpha3.DeviceAttribute is actually referenced by resource.v1alpha3.BasicDevice, so we need to traverse the additionalProperties array and ensure that we mark the g/v/k as being used.

dims commented 4 weeks ago

/assign @tengqm

tengqm commented 3 weeks ago

@dims I was thinking when and how I can resolve this defect. Thank you so much. /approve

k8s-ci-robot commented 3 weeks ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, tengqm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/reference-docs/blob/master/OWNERS)~~ [tengqm] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
hakuna-matatah commented 3 weeks ago

/lgtm