Commit 8b5317bf authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #32141 from deads2k/client-01-fix-swagger

Automatic merge from submit-queue make swaggerschema agnostic about which version to use `Factory.SwaggerSchema` was reliant on having a non-generated client bits filled in so that it could get the adapted client it wanted. There's no need since discovery ignores configured GroupVersions. This eliminates the unneeded dependency.
parents 56242964 aee962c0
......@@ -741,12 +741,18 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return validation.NullSchema{}, nil
},
SwaggerSchema: func(gvk unversioned.GroupVersionKind) (*swagger.ApiDeclaration, error) {
version := gvk.GroupVersion()
client, err := clients.ClientForVersion(&version)
// discovery doesn't care about which groupversion you get a client for,
// so get whichever one you happen to have available and use that.
cfg, err := clients.ClientConfigForVersion(nil)
if err != nil {
return nil, err
}
dc, err := discovery.NewDiscoveryClientForConfig(cfg)
if err != nil {
return nil, err
}
return client.Discovery().SwaggerSchema(version)
return dc.SwaggerSchema(gvk.GroupVersion())
},
DefaultNamespace: func() (string, bool, error) {
return clientConfig.Namespace()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment