Commit aee962c0 authored by deads2k's avatar deads2k

make swaggerschema agnostic about which version to use

parent c9fde2ba
......@@ -740,12 +740,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