controller-tools
controller-tools copied to clipboard
Generating OpenAPI spec (OAS) along with CRD
Looking for suggestions.
I am generating Kubernetes CRD (Custom Resource Definition) using kubebuilder. Along with CRD, I also need to document the REST endpoints by creating OpenAPI v3 Spec (OAS) file. Is there a way to get this done using controller-gen? (I see that kubebuilder uses controller-gen to create the CRD) and it was recommended to ask the question in this space). I tried exploring +schemapatch generator but felt like it's there for a different reason.
I also want to add sample Request/Response payload and other OpenAPI details (in <>types.go file) to generate complete OAS file. The reason I want to use types.go file as I will have just one source of truth and I don't need to manually write/edit the OAS file.
Any other way would you recommend if controller-gen is not the right tool for this.
Thanks in advance.