code-generator
code-generator copied to clipboard
Generate json-schema from go types
When you create a CRD, it can have a schema defined using json-schema.
In github.com/kubernetes/sample-controller the client libraries for a controller are generated from a go API definition, and CRDs are created, but there is no schema for the CRD, which means less validation.
It would be nice to generate the json-schema for the CRD from the Go types. So, this is proposing a new generator that generates json-schema for CRDs from go types.
xref https://github.com/kubernetes/sample-controller/issues/2
/cc @sttts @munnerz @mbohlool
@erictune we discussed the very same idea at KubeCon. We have openapi-gen which produces a Golang snippet now which is very similar to a JSON Schema already. @munnerz wanted to prototype a change to openapi-gen with your described goal.
Yep - likely I won't have a chance to get onto this until next week, as this is my final week before xmas. I think @sttts and I discussed initially adding an 'output format' parameter to openapi-gen in order to facilitate this.
/assign
+1 to this. I'm looking into having the cluster registry be a CRD and this would be a boon for that.
https://github.com/kubernetes/kube-openapi/pull/37 needs review time.
I’m happy to follow up with additional features (such as comments tags to allow specifying regex’s to validate with, etc) once the structure/design is accepted too.
I just didn’t want to rush ahead and introduce a load of new functionality without being sure that the way it’s implemented makes sense! On Thu, 8 Mar 2018 at 07:31, Dr. Stefan Schimanski [email protected] wrote:
kubernetes/kube-openapi#37 https://github.com/kubernetes/kube-openapi/pull/37 needs review time.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/kubernetes/code-generator/issues/28#issuecomment-371404172, or mute the thread https://github.com/notifications/unsubscribe-auth/AAMbP-0p3ZXuuHRFBGV3uXD42qCST1Efks5tcN5jgaJpZM4Q-YKH .
I just came across this which looks similar: https://github.com/ant31/crd-validation
I expect we will take this on in kube-openapi and not here.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close
.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
/lifecycle frozen
On Tue, Oct 9, 2018 at 11:52 PM fejta-bot [email protected] wrote:
Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta https://github.com/fejta. /lifecycle rotten
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/code-generator/issues/28#issuecomment-428297792, or mute the thread https://github.com/notifications/unsubscribe-auth/APXA0B2EtSWfjmfM0G2tSme-gH3-22mFks5ujOlNgaJpZM4Q-YKH .
/unassign mbohlool
Work on this is going on in http://github.com/kubernetes-sigs/controller-tools.
/close
stale?
@thockin: Closing this issue.
In response to this:
/close
stale?
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.