{"action":"closed","issue":{"url":"https://api.github.com/repos/kongchen/swagger-maven-plugin/issues/139","labels_url":"https://api.github.com/repos/kongchen/swagger-maven-plugin/issues/139/labels{/name}","comments_url":"https://api.github.com/repos/kongchen/swagger-maven-plugin/issues/139/comments","events_url":"https://api.github.com/repos/kongchen/swagger-maven-plugin/issues/139/events","html_url":"https://github.com/kongchen/swagger-maven-plugin/issues/139","id":73102983,"number":139,"title":"How are top-level securityDefinitions defined?","user":{"login":"who","id":282534,"avatar_url":"https://avatars.githubusercontent.com/u/282534?v=3","gravatar_id":"","url":"https://api.github.com/users/who","html_url":"https://github.com/who","followers_url":"https://api.github.com/users/who/followers","following_url":"https://api.github.com/users/who/following{/other_user}","gists_url":"https://api.github.com/users/who/gists{/gist_id}","starred_url":"https://api.github.com/users/who/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/who/subscriptions","organizations_url":"https://api.github.com/users/who/orgs","repos_url":"https://api.github.com/users/who/repos","events_url":"https://api.github.com/users/who/events{/privacy}","received_events_url":"https://api.github.com/users/who/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-05-04T19:14:51Z","updated_at":"2015-05-08T19:42:47Z","closed_at":"2015-05-08T19:42:47Z","body":"It appears that there is no way to define a securityDefinition at the root level. \r\n\r\nThis ApiOperation ... \r\n\r\n```\r\n@RestController\r\n@RequestMapping(\"/test\")\r\n@Api(value = \"test\")\r\npublic class test{\r\n    @RequestMapping(\r\n        value = \"/testing\", \r\n        method = RequestMethod.GET, \r\n        produces = MediaType.TEXT_PLAIN_VALUE)\r\n    @ApiOperation(\r\n        value = \"testing\",\r\n        authorizations = @Authorization(value = \"basicAuth\", type = \"basicAuth\")\r\n    )\r\n    public String testMethod() {\r\n        return \"testing\";\r\n    }\r\n}\r\n```\r\n\r\n... yields this json ...\r\n\r\n```\r\n  \"paths\" : {\r\n    \"/test/testing\" : {\r\n      \"get\" : {\r\n        \"tags\" : [ \"test\" ],\r\n        \"summary\" : \"testing\",\r\n        \"description\" : \"\",\r\n        \"operationId\" : \"testMethod\",\r\n        \"produces\" : [ \"text/plain\" ],\r\n        \"responses\" : {\r\n          \"200\" : {\r\n            \"description\" : \"successful operation\",\r\n            \"schema\" : {\r\n              \"type\" : \"string\"\r\n            }\r\n          }\r\n        },\r\n        \"security\" : [ {\r\n          \"basicAuth\" : [ ]\r\n        } ]\r\n      }\r\n    }\r\n  }\r\n```\r\n\r\nHowever, there is no `securityDefinition` defined at the root level, so the spec is not valid. \r\n\r\nHere is the relevant section in the Swagger 2.0 spec definition: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#security-definitions-object\r\n\r\n"}}