{"action":"created","issue":{"url":"https://api.github.com/repos/go-swagger/go-swagger/issues/796","repository_url":"https://api.github.com/repos/go-swagger/go-swagger","labels_url":"https://api.github.com/repos/go-swagger/go-swagger/issues/796/labels{/name}","comments_url":"https://api.github.com/repos/go-swagger/go-swagger/issues/796/comments","events_url":"https://api.github.com/repos/go-swagger/go-swagger/issues/796/events","html_url":"https://github.com/go-swagger/go-swagger/issues/796","id":196474670,"number":796,"title":"Definitions are generated without use of `swagger:model`","user":{"login":"GlenDC","id":3900482,"avatar_url":"https://avatars.githubusercontent.com/u/3900482?v=3","gravatar_id":"","url":"https://api.github.com/users/GlenDC","html_url":"https://github.com/GlenDC","followers_url":"https://api.github.com/users/GlenDC/followers","following_url":"https://api.github.com/users/GlenDC/following{/other_user}","gists_url":"https://api.github.com/users/GlenDC/gists{/gist_id}","starred_url":"https://api.github.com/users/GlenDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GlenDC/subscriptions","organizations_url":"https://api.github.com/users/GlenDC/orgs","repos_url":"https://api.github.com/users/GlenDC/repos","events_url":"https://api.github.com/users/GlenDC/events{/privacy}","received_events_url":"https://api.github.com/users/GlenDC/received_events","type":"User","site_admin":false},"labels":[{"id":148436504,"url":"https://api.github.com/repos/go-swagger/go-swagger/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-19T17:30:31Z","updated_at":"2016-12-21T04:26:23Z","closed_at":null,"body":"## Problem statement\r\n\r\nExtra (unwanted) definitions get generated when generating a spec using the `-m` flag.\r\n\r\nMore information about this flag: https://github.com/go-swagger/go-swagger/blob/master/cmd/swagger/commands/generate/spec.go#L32\r\n\r\n## Steps to reproduce\r\n\r\nCreate following main file somewhere in your `$GOPATH`:\r\n\r\n```go\r\n// A Bug API\r\n//\r\n// An API Definition to show a bug in go-swagger.\r\n//\r\n// Because of the bug, definitions get generated from types\r\n// which have no `model` annotation\r\n//\r\n// swagger:meta\r\npackage main\r\n\r\n// Ping Response\r\n//\r\n// swagger:model pingResponse\r\ntype pingResponse struct {\r\n}\r\n\r\ntype Handler interface {\r\n    Foo() int\r\n}\r\n\r\n// swagger:parameters ping\r\ntype pingParams struct {\r\n    // Represents who is pinging\r\n    //\r\n    // in: path\r\n    // required: true\r\n    Who string `json:\"who\"`\r\n}\r\n\r\n// swagger:route GET /ping/{who} ping\r\n//\r\n// Test your connection with this service.\r\n//\r\n//    Produces:\r\n//      plain/text\r\n//\r\n//    Responses:\r\n//      200: body:pingResponse\r\nfunc ping() {\r\n\r\n}\r\n\r\nfunc main() {\r\n}\r\n```\r\n\r\nGenerate the spec using following command:\r\n\r\n```\r\n$ swagger generate spec -m -o ./swagger.json\r\n```\r\n\r\nIn the generated file you should see following unwanted definitions:\r\n\r\n```json\r\n\"definitions\": {\r\n    \"Handler\": {\r\n        \"type\": \"object\",\r\n        \"properties\": {\r\n            \"Foo\": {\r\n                \"type\": \"integer\",\r\n                \"format\": \"int64\"\r\n            }\r\n        },\r\n        \"x-go-package\": \"github.com/glendc/tmp/extra-definitions\"\r\n    },\r\n    \"pingParams\": {\r\n        \"type\": \"object\",\r\n        \"required\": [\r\n            \"who\"\r\n        ],\r\n        \"properties\": {\r\n            \"who\": {\r\n                \"description\": \"Represents who is pinging\\n\\nin: path\",\r\n                \"type\": \"string\",\r\n                \"x-go-name\": \"Who\"\r\n            }\r\n        },\r\n        \"x-go-package\": \"github.com/glendc/tmp/extra-definitions\"\r\n    }\r\n}\r\n```\r\n\r\n+ `pingParams` should not be defined as a definition:\r\n  + it has no `swagger:model` annotation;\r\n  + it is a _struct_ used to define the params for the `ping` operation;\r\n+ `Handler` should not be defined as a definition:\r\n  + it has no annotations at all;\r\n  + it is an _interface_ and has nothing to do with the swagger spec;"},"comment":{"url":"https://api.github.com/repos/go-swagger/go-swagger/issues/comments/268432539","html_url":"https://github.com/go-swagger/go-swagger/issues/796#issuecomment-268432539","issue_url":"https://api.github.com/repos/go-swagger/go-swagger/issues/796","id":268432539,"user":{"login":"GlenDC","id":3900482,"avatar_url":"https://avatars.githubusercontent.com/u/3900482?v=3","gravatar_id":"","url":"https://api.github.com/users/GlenDC","html_url":"https://github.com/GlenDC","followers_url":"https://api.github.com/users/GlenDC/followers","following_url":"https://api.github.com/users/GlenDC/following{/other_user}","gists_url":"https://api.github.com/users/GlenDC/gists{/gist_id}","starred_url":"https://api.github.com/users/GlenDC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GlenDC/subscriptions","organizations_url":"https://api.github.com/users/GlenDC/orgs","repos_url":"https://api.github.com/users/GlenDC/repos","events_url":"https://api.github.com/users/GlenDC/events{/privacy}","received_events_url":"https://api.github.com/users/GlenDC/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T04:26:23Z","updated_at":"2016-12-21T04:26:23Z","body":"The following `TODO` (https://github.com/go-swagger/go-swagger/blob/master/scan/schema.go#L438) is the source of this bug. Solve the TODO, and the bug is probably solved as well."}}
{"actor":{"display_login":"GlenDC"}}