mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
update kyaml go.mod and go.sum
also update cmd/config,cmd/kubectl,cmd/resource
This commit is contained in:
@@ -9,7 +9,6 @@ require (
|
|||||||
github.com/spf13/cobra v0.0.5
|
github.com/spf13/cobra v0.0.5
|
||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
|
|
||||||
k8s.io/apimachinery v0.17.0
|
k8s.io/apimachinery v0.17.0
|
||||||
sigs.k8s.io/kustomize/kyaml v0.0.0
|
sigs.k8s.io/kustomize/kyaml v0.0.0
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -101,6 +101,8 @@ github.com/posener/complete/v2 v2.0.1-alpha.12/go.mod h1://JlL91cS2JV7rOl6LVHrRq
|
|||||||
github.com/posener/script v1.0.4 h1:nSuXW5ZdmFnQIueLB2s0qvs4oNsUloM1Zydzh75v42w=
|
github.com/posener/script v1.0.4 h1:nSuXW5ZdmFnQIueLB2s0qvs4oNsUloM1Zydzh75v42w=
|
||||||
github.com/posener/script v1.0.4/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E=
|
github.com/posener/script v1.0.4/go.mod h1:Rg3ijooqulo05aGLyGsHoLmIOUzHUVK19WVgrYBPU/E=
|
||||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||||
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
|
github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s=
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
|||||||
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
|
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
|
||||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
|
||||||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||||
@@ -213,6 +214,7 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
|
|||||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||||
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
|
||||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||||
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
@@ -331,6 +333,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
|
|||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
||||||
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
|
|||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||||
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
|
||||||
|
github.com/go-bindata/go-bindata v3.1.2+incompatible/go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo=
|
||||||
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
|
||||||
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
|
||||||
github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg=
|
github.com/go-logr/logr v0.1.0 h1:M1Tv3VzNlEHg6uyACnRdtrploV2P7wZqH8BoQMtz0cg=
|
||||||
@@ -217,6 +218,7 @@ github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nL
|
|||||||
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
|
||||||
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||||
github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
github.com/soheilhy/cmux v0.1.3/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
|
||||||
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ require (
|
|||||||
github.com/davecgh/go-spew v1.1.1
|
github.com/davecgh/go-spew v1.1.1
|
||||||
github.com/go-errors/errors v1.0.1
|
github.com/go-errors/errors v1.0.1
|
||||||
github.com/go-openapi/spec v0.19.5
|
github.com/go-openapi/spec v0.19.5
|
||||||
|
github.com/sergi/go-diff v1.1.0
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca
|
github.com/xlab/treeprint v0.0.0-20181112141820-a009c3971eca
|
||||||
|
gopkg.in/yaml.v2 v2.2.4
|
||||||
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d
|
gopkg.in/yaml.v3 v3.0.0-20191026110619-0b21df46bc1d
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq
|
|||||||
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
|
||||||
|
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||||
@@ -45,6 +47,8 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm
|
|||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ type formatter struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// fmtNode recursively formats the Document Contents.
|
// fmtNode recursively formats the Document Contents.
|
||||||
|
// See: https://godoc.org/gopkg.in/yaml.v3#Node
|
||||||
func (f *formatter) fmtNode(n *yaml.Node, path string, schema *openapi.ResourceSchema) error {
|
func (f *formatter) fmtNode(n *yaml.Node, path string, schema *openapi.ResourceSchema) error {
|
||||||
if n.Kind == yaml.ScalarNode && schema != nil && schema.Schema != nil {
|
if n.Kind == yaml.ScalarNode && schema != nil && schema.Schema != nil {
|
||||||
// ensure values that are interpreted as non-string values (e.g. "true")
|
// ensure values that are interpreted as non-string values (e.g. "true")
|
||||||
@@ -142,12 +143,12 @@ func (f *formatter) fmtNode(n *yaml.Node, path string, schema *openapi.ResourceS
|
|||||||
// if the node is a field, lookup the schema using the field name
|
// if the node is a field, lookup the schema using the field name
|
||||||
p = fmt.Sprintf("%s.%s", path, n.Content[i-1].Value)
|
p = fmt.Sprintf("%s.%s", path, n.Content[i-1].Value)
|
||||||
if schema != nil {
|
if schema != nil {
|
||||||
s = schema.SchemaForField(n.Content[i-1].Value)
|
s = schema.Field(n.Content[i-1].Value)
|
||||||
}
|
}
|
||||||
case isElement:
|
case isElement:
|
||||||
// if the node is a list element, lookup the schema for the array items
|
// if the node is a list element, lookup the schema for the array items
|
||||||
if schema != nil {
|
if schema != nil {
|
||||||
s = schema.SchemaForElements()
|
s = schema.Elements()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ import (
|
|||||||
func Example() {
|
func Example() {
|
||||||
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
||||||
|
|
||||||
f := s.SchemaForField("spec").
|
f := s.Lookup("spec", "replicas")
|
||||||
SchemaForField("replicas")
|
|
||||||
fmt.Println(f.Schema.Description[:70] + "...")
|
fmt.Println(f.Schema.Description[:70] + "...")
|
||||||
fmt.Println(f.Schema.Type)
|
fmt.Println(f.Schema.Type)
|
||||||
|
|
||||||
@@ -26,10 +25,7 @@ func Example() {
|
|||||||
func Example_arrayMerge() {
|
func Example_arrayMerge() {
|
||||||
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
||||||
|
|
||||||
f := s.SchemaForField("spec").
|
f := s.Lookup("spec", "template", "spec", "containers")
|
||||||
SchemaForField("template").
|
|
||||||
SchemaForField("spec").
|
|
||||||
SchemaForField("containers")
|
|
||||||
fmt.Println(f.Schema.Description[:70] + "...")
|
fmt.Println(f.Schema.Description[:70] + "...")
|
||||||
fmt.Println(f.Schema.Type)
|
fmt.Println(f.Schema.Type)
|
||||||
fmt.Println(f.PatchStrategyAndKey()) // merge patch strategy on name
|
fmt.Println(f.PatchStrategyAndKey()) // merge patch strategy on name
|
||||||
@@ -43,11 +39,7 @@ func Example_arrayMerge() {
|
|||||||
func Example_arrayReplace() {
|
func Example_arrayReplace() {
|
||||||
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
||||||
|
|
||||||
f := s.SchemaForField("spec").
|
f := s.Lookup("spec", "template", "spec", "containers", openapi.Elements, "args")
|
||||||
SchemaForField("template").
|
|
||||||
SchemaForField("spec").
|
|
||||||
SchemaForField("containers").SchemaForElements().
|
|
||||||
SchemaForField("args")
|
|
||||||
fmt.Println(f.Schema.Description[:70] + "...")
|
fmt.Println(f.Schema.Description[:70] + "...")
|
||||||
fmt.Println(f.Schema.Type)
|
fmt.Println(f.Schema.Type)
|
||||||
fmt.Println(f.PatchStrategyAndKey()) // no patch strategy or merge key
|
fmt.Println(f.PatchStrategyAndKey()) // no patch strategy or merge key
|
||||||
@@ -60,12 +52,8 @@ func Example_arrayReplace() {
|
|||||||
func Example_arrayElement() {
|
func Example_arrayElement() {
|
||||||
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
||||||
|
|
||||||
f := s.SchemaForField("spec").
|
f := s.Lookup("spec", "template", "spec", "containers",
|
||||||
SchemaForField("template").
|
openapi.Elements, "ports", openapi.Elements, "containerPort")
|
||||||
SchemaForField("spec").
|
|
||||||
SchemaForField("containers").SchemaForElements().
|
|
||||||
SchemaForField("ports").SchemaForElements().
|
|
||||||
SchemaForField("containerPort")
|
|
||||||
fmt.Println(f.Schema.Description[:70] + "...")
|
fmt.Println(f.Schema.Description[:70] + "...")
|
||||||
fmt.Println(f.Schema.Type)
|
fmt.Println(f.Schema.Type)
|
||||||
|
|
||||||
@@ -77,7 +65,7 @@ func Example_arrayElement() {
|
|||||||
func Example_map() {
|
func Example_map() {
|
||||||
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
s := openapi.SchemaForResourceType(yaml.TypeMeta{APIVersion: "apps/v1", Kind: "Deployment"})
|
||||||
|
|
||||||
f := s.SchemaForField("metadata").SchemaForField("labels")
|
f := s.Lookup("metadata", "labels")
|
||||||
fmt.Println(f.Schema.Description[:70] + "...")
|
fmt.Println(f.Schema.Description[:70] + "...")
|
||||||
fmt.Println(f.Schema.Type)
|
fmt.Println(f.Schema.Type)
|
||||||
|
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ func SchemaForResourceType(t yaml.TypeMeta) *ResourceSchema {
|
|||||||
return &ResourceSchema{Schema: rs}
|
return &ResourceSchema{Schema: rs}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchemaForElements returns the Schema for the elements of an array.
|
// Elements returns the Schema for the elements of an array.
|
||||||
func (r *ResourceSchema) SchemaForElements() *ResourceSchema {
|
func (r *ResourceSchema) Elements() *ResourceSchema {
|
||||||
// load the schema from swagger.json
|
// load the schema from swagger.json
|
||||||
initSchema()
|
initSchema()
|
||||||
|
|
||||||
@@ -53,8 +53,30 @@ func (r *ResourceSchema) SchemaForElements() *ResourceSchema {
|
|||||||
return &ResourceSchema{Schema: &s}
|
return &ResourceSchema{Schema: &s}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SchemaForField returns the Schema for a field.
|
const Elements = "[]"
|
||||||
func (r *ResourceSchema) SchemaForField(field string) *ResourceSchema {
|
|
||||||
|
// Lookup calls either Field or Elements for each item in the path.
|
||||||
|
// If the path item is "[]", then Elements is called, otherwise
|
||||||
|
// Field is called.
|
||||||
|
// If any Field or Elements call returns nil, then Lookup returns
|
||||||
|
// nil immediately.
|
||||||
|
func (r *ResourceSchema) Lookup(path ...string) *ResourceSchema {
|
||||||
|
s := r
|
||||||
|
for _, p := range path {
|
||||||
|
if s == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if p == Elements {
|
||||||
|
s = s.Elements()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
s = s.Field(p)
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
// Field returns the Schema for a field.
|
||||||
|
func (r *ResourceSchema) Field(field string) *ResourceSchema {
|
||||||
// load the schema from swagger.json
|
// load the schema from swagger.json
|
||||||
initSchema()
|
initSchema()
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func TestSchemaForResourceType(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
f := s.SchemaForField("spec")
|
f := s.Field("spec")
|
||||||
if !assert.NotNil(t, f) {
|
if !assert.NotNil(t, f) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ func TestSchemaForResourceType(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
replicas := f.SchemaForField("replicas")
|
replicas := f.Field("replicas")
|
||||||
if !assert.NotNil(t, replicas) {
|
if !assert.NotNil(t, replicas) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
@@ -36,7 +36,7 @@ func TestSchemaForResourceType(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
temp := f.SchemaForField("template")
|
temp := f.Field("template")
|
||||||
if !assert.NotNil(t, temp) {
|
if !assert.NotNil(t, temp) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
@@ -45,16 +45,12 @@ func TestSchemaForResourceType(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
containers := temp.SchemaForField("spec").
|
containers := temp.Field("spec").Field("containers").Elements()
|
||||||
SchemaForField("containers").
|
|
||||||
SchemaForElements()
|
|
||||||
if !assert.NotNil(t, containers) {
|
if !assert.NotNil(t, containers) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
targetPort := containers.SchemaForField("ports").
|
targetPort := containers.Field("ports").Elements().Field("containerPort")
|
||||||
SchemaForElements().
|
|
||||||
SchemaForField("containerPort")
|
|
||||||
if !assert.NotNil(t, targetPort) {
|
if !assert.NotNil(t, targetPort) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
@@ -63,8 +59,7 @@ func TestSchemaForResourceType(t *testing.T) {
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|
||||||
arg := containers.SchemaForField("args").
|
arg := containers.Field("args").Elements()
|
||||||
SchemaForElements()
|
|
||||||
if !assert.NotNil(t, arg) {
|
if !assert.NotNil(t, arg) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,14 +61,8 @@ spec:
|
|||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
on := args.YNode().Content[1]
|
on := args.YNode().Content[1]
|
||||||
onS := s.
|
onS := s.Lookup(
|
||||||
SchemaForField("spec").
|
"spec", "template", "spec", "containers", openapi.Elements, "args", openapi.Elements)
|
||||||
SchemaForField("template").
|
|
||||||
SchemaForField("spec").
|
|
||||||
SchemaForField("containers").
|
|
||||||
SchemaForElements().
|
|
||||||
SchemaForField("args").
|
|
||||||
SchemaForElements()
|
|
||||||
yaml.FormatNonStringStyle(on, *onS.Schema)
|
yaml.FormatNonStringStyle(on, *onS.Schema)
|
||||||
|
|
||||||
containerPort, err := n.Pipe(yaml.Lookup(
|
containerPort, err := n.Pipe(yaml.Lookup(
|
||||||
@@ -80,15 +74,8 @@ spec:
|
|||||||
if !assert.NotNil(t, containerPort) {
|
if !assert.NotNil(t, containerPort) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
cpS := s.
|
cpS := s.Lookup("spec", "template", "spec", "containers", openapi.Elements,
|
||||||
SchemaForField("spec").
|
"ports", openapi.Elements, "containerPort")
|
||||||
SchemaForField("template").
|
|
||||||
SchemaForField("spec").
|
|
||||||
SchemaForField("containers").
|
|
||||||
SchemaForElements().
|
|
||||||
SchemaForField("ports").
|
|
||||||
SchemaForElements().
|
|
||||||
SchemaForField("containerPort")
|
|
||||||
if !assert.NotNil(t, cpS) {
|
if !assert.NotNil(t, cpS) {
|
||||||
t.FailNow()
|
t.FailNow()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user