{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/39069408","id":39069408,"diff_hunk":"@@ -171,6 +175,49 @@ func (c *Client) ValidateComponents() (*api.ComponentStatusList, error) {\n \treturn &api.ComponentStatusList{Items: statuses}, nil\n }\n \n+// SwaggerSchemaInterface has a method to retrieve the swagger schema. Used in\n+// client.Interface\n+type SwaggerSchemaInterface interface {\n+\tSwaggerSchema(version string) (*swagger.ApiDeclaration, error)\n+}\n+\n+// SwaggerSchema retrieves and parses the swagger API schema the server supports.\n+func (c *Client) SwaggerSchema(version string) (*swagger.ApiDeclaration, error) {\n+\tif version == \"\" {\n+\t\tversion = latest.Version\n+\t}\n+\n+\tvers, err := c.ServerAPIVersions()\n+\tif err != nil {\n+\t\treturn nil, err\n+\t}\n+\n+\t// This check also takes care the case that kubectl is newer than the running endpoint\n+\tif stringDoesntExistIn(version, vers.Versions) {\n+\t\treturn nil, fmt.Errorf(\"API version: %s is not supported by the server. Use one of: %v\", version, vers.Versions)","path":"pkg/client/unversioned/client.go","position":42,"original_position":42,"commit_id":"056340f69987c05bfbac4f92e395f80496bd3af5","original_commit_id":"c866a9fac8993aabe906c2f5413278beabbc3f98","user":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"body":"Yes, `--api-version` is a global flag. We should support that. ","created_at":"2015-09-09T17:07:43Z","updated_at":"2015-09-09T17:07:43Z","html_url":"https://github.com/kubernetes/kubernetes/pull/12677#discussion_r39069408","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/39069408"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/12677#discussion_r39069408"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677","id":42384445,"html_url":"https://github.com/kubernetes/kubernetes/pull/12677","diff_url":"https://github.com/kubernetes/kubernetes/pull/12677.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/12677.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12677","number":12677,"state":"open","locked":false,"title":"A new command to read types' description from Swagger","user":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"body":"This is a simple kubectl tool that parses the swagger schema and returns useful information for the various models/types we have.\r\n\r\nHere you can see an example output:\r\n```\r\n# kubectl doc model Pod\r\nMODEL: Pod\r\nPod is a collection of containers that can run on a host. This resource is created by clients and scheduled onto hosts.\r\n\r\nFIELD DESCRIPTIONS\r\n-> spec\t<PodSpec>\r\n     Specification of the desired behavior of the pod. More info:\r\n     http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status\r\n\r\n-> status\t<PodStatus>\r\n     Most recently observed status of the pod. This data may not be up to date.\r\n     Populated by the system. Read-only. More info:\r\n     http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status\r\n\r\n-> apiVersion\t<string>\r\n     APIVersion defines the version of the schema of an object. Servers should\r\n     convert recognized schemas to the latest internal value, and may reject\r\n     unrecognized values. More info:\r\n     http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#resources\r\n\r\n-> kind\t<string>\r\n     A string value representing the REST resource this object represents.\r\n     Servers may infer this from the endpoint the client submits requests to.\r\n     Cannot be updated. In CamelCase. More info:\r\n     http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds\r\n\r\n-> metadata\t<ObjectMeta>\r\n     Standard object's metadata. More info:\r\n     http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata\r\n```\r\n\r\nand has this interface:\r\n```\r\n# kubectl help doc\r\nDocumentation of models and operations. API version in models can be defined as a prefix: v1.MODEL. For operations is embedded in the URL.\r\n\r\nUsage:\r\n  kubectl doc model MODEL-NAME | operation URL [GET|POST|PUT|DELETE|PATCH] [flags]\r\n\r\nExamples:\r\n# Get the documentation of the model and its fields\r\n$ kubectl doc model Pod\r\n\r\n# Get the documentation of a specific model that represents a field of an other\r\n$ kubectl doc model Pod.spec.containers\r\n\r\n# Search for models with similar name\r\nkubectl doc model -S Pod\r\n\r\n# Get all available operations (GET|POST...) of a URL. {name} can be an arbitrary string.\r\nkubectl doc operation /api/v1/namespaces/{name}\r\n\r\n# Get the documentation of the specific operation\r\nkubectl doc operation /api/v1/namespaces/{name} GET\r\n\r\n# Search for similar operations\r\nkubectl doc operation -S /api/v1/namespaces\r\n\r\nFlags:\r\n  -h, --help[=false]: help for doc\r\n  -S, --search[=false]: Search for similar models to given MODEL-NAME or URL\r\n```\r\n\r\nWe also support searching through the `-S` flag like this:\r\n```\r\n#kubectl doc model -S Pod\r\nPodSpec\r\nPodList\r\nPod\r\nPodCondition\r\nPodStatus\r\nPodTemplateList\r\nPodTemplateSpec\r\nPodTemplate\r\n```\r\n\r\nAn other feature we have is a \"dot\" notation on `Model.attribute.attribute` for further exploration of the API:\r\n```\r\n#kubectl doc Pod.status.conditions\r\nMODEL: PodCondition\r\nPodCondition contains details for the current condition of this pod.\r\n\r\nFIELD DESCRIPTIONS\r\n+--------+----------+--------------------------------------------------------------------------+\r\n| status | <string> | Status is the status of the condition.                                   |\r\n|        |          | Can be True, False, Unknown. More info:                                  |\r\n|        |          | http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#pod-conditions |\r\n+--------+----------+--------------------------------------------------------------------------+\r\n| type   | <string> | Type is the type of the condition. Currently only Ready. More info:      |\r\n|        |          | http://releases.k8s.io/HEAD/docs/user-guide/pod-states.md#pod-conditions |\r\n+--------+----------+--------------------------------------------------------------------------+\r\n```\r\n\r\n```\r\n#kubectl doc put /api/v1/namespaces/sdad\r\nSupported methods for: PUT /api/v1/namespaces/{name}\r\n\r\nParameters\r\n+-------+--------+--------------------------------+----------+--------------+---------+\r\n| TYPE  |  NAME  |          DESCRIPTION           | REQUIRED |    SCHEMA    | DEFAULT |\r\n+-------+--------+--------------------------------+----------+--------------+---------+\r\n| query | pretty | If 'true', then the output is  | false    | string       |         |\r\n|       |        | pretty printed.                |          |              |         |\r\n+-------+--------+--------------------------------+----------+--------------+---------+\r\n| body  | body   |                                | true     | v1.Namespace |         |\r\n+-------+--------+--------------------------------+----------+--------------+---------+\r\n| path  | name   | name of the Namespace          | true     | string       |         |\r\n+-------+--------+--------------------------------+----------+--------------+---------+\r\n\r\nResponses\r\n+-----------+-------------+--------------+\r\n| HTTP CODE | DESCRIPTION |    SCHEMA    |\r\n+-----------+-------------+--------------+\r\n|       200 | OK          | v1.Namespace |\r\n+-----------+-------------+--------------+\r\n\r\nConsumes\r\n  -> */*\r\n\r\nProduces\r\n  -> application/json\r\n```\r\n\r\n### IMPORTANT NOTE\r\nUntil #10933 is finished, the big gap under the MODEL title exists due to the absence of struct description.\r\n\r\n/cc @ghodss ","created_at":"2015-08-13T18:44:26Z","updated_at":"2015-09-09T17:07:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2fd963d38cfabe6eb74aeb1602be8cec354b937e","assignee":{"login":"JanetKuo","id":4876867,"avatar_url":"https://avatars.githubusercontent.com/u/4876867?v=3","gravatar_id":"","url":"https://api.github.com/users/JanetKuo","html_url":"https://github.com/JanetKuo","followers_url":"https://api.github.com/users/JanetKuo/followers","following_url":"https://api.github.com/users/JanetKuo/following{/other_user}","gists_url":"https://api.github.com/users/JanetKuo/gists{/gist_id}","starred_url":"https://api.github.com/users/JanetKuo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanetKuo/subscriptions","organizations_url":"https://api.github.com/users/JanetKuo/orgs","repos_url":"https://api.github.com/users/JanetKuo/repos","events_url":"https://api.github.com/users/JanetKuo/events{/privacy}","received_events_url":"https://api.github.com/users/JanetKuo/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/12677/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/056340f69987c05bfbac4f92e395f80496bd3af5","head":{"label":"andronat:kubectl_doc_cmd","ref":"kubectl_doc_cmd","sha":"056340f69987c05bfbac4f92e395f80496bd3af5","user":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"repo":{"id":35010334,"name":"kubernetes","full_name":"andronat/kubernetes","owner":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andronat/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/andronat/kubernetes","forks_url":"https://api.github.com/repos/andronat/kubernetes/forks","keys_url":"https://api.github.com/repos/andronat/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andronat/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andronat/kubernetes/teams","hooks_url":"https://api.github.com/repos/andronat/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/andronat/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/andronat/kubernetes/events","assignees_url":"https://api.github.com/repos/andronat/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/andronat/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/andronat/kubernetes/tags","blobs_url":"https://api.github.com/repos/andronat/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andronat/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andronat/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/andronat/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andronat/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/andronat/kubernetes/languages","stargazers_url":"https://api.github.com/repos/andronat/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/andronat/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/andronat/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/andronat/kubernetes/subscription","commits_url":"https://api.github.com/repos/andronat/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/andronat/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/andronat/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/andronat/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/andronat/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/andronat/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andronat/kubernetes/merges","archive_url":"https://api.github.com/repos/andronat/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andronat/kubernetes/downloads","issues_url":"https://api.github.com/repos/andronat/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/andronat/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/andronat/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/andronat/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andronat/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/andronat/kubernetes/releases{/id}","created_at":"2015-05-04T02:39:56Z","updated_at":"2015-05-04T02:45:04Z","pushed_at":"2015-09-09T14:56:08Z","git_url":"git://github.com/andronat/kubernetes.git","ssh_url":"git@github.com:andronat/kubernetes.git","clone_url":"https://github.com/andronat/kubernetes.git","svn_url":"https://github.com/andronat/kubernetes","homepage":"http://kubernetes.io","size":103775,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"f5ee560b28cddae13cb6fcbbd0e26c1083658c98","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-09-09T15:39:57Z","pushed_at":"2015-09-09T17:04:45Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":401152,"stargazers_count":10151,"watchers_count":10151,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2484,"mirror_url":null,"open_issues_count":1718,"forks":2484,"open_issues":1718,"watchers":10151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/12677"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/12677"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/12677/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/12677/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/056340f69987c05bfbac4f92e395f80496bd3af5"}}}}