{"action":"created","issue":{"url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/15","repository_url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin","labels_url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/15/comments","events_url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/15/events","html_url":"https://github.com/gigaSproule/swagger-gradle-plugin/issues/15","id":239710188,"number":15,"title":"Can't discover JSON security definition file when in project resources","user":{"login":"plechev","id":1397441,"avatar_url":"https://avatars0.githubusercontent.com/u/1397441?v=3","gravatar_id":"","url":"https://api.github.com/users/plechev","html_url":"https://github.com/plechev","followers_url":"https://api.github.com/users/plechev/followers","following_url":"https://api.github.com/users/plechev/following{/other_user}","gists_url":"https://api.github.com/users/plechev/gists{/gist_id}","starred_url":"https://api.github.com/users/plechev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plechev/subscriptions","organizations_url":"https://api.github.com/users/plechev/orgs","repos_url":"https://api.github.com/users/plechev/repos","events_url":"https://api.github.com/users/plechev/events{/privacy}","received_events_url":"https://api.github.com/users/plechev/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-06-30T08:25:30Z","updated_at":"2017-06-30T09:58:50Z","closed_at":null,"body":"The following configuration results in JSON parse error which is caused by inability to discover the file _service-security.json_. The problem is present in all cases with file placed either in _main/resources_, _main/java_ or at project's root. \r\nFurther debugging reveals that the classloader used when the plugin executes has no access to the project's files, be it resources or Java source files.    \r\n\r\nCode in _build.gradle_: \r\n\r\n```\r\nswagger {\r\n    apiSource {\r\n        locations = ['my.package']\r\n        basePath = '/api'\r\n        info {\r\n            title = \"Service API\"\r\n            version = project.version\r\n        }\r\n        jsonExampleValues = true \r\n        swaggerDirectory = \"${project.buildDir}/generated/docs/\"\r\n        outputFormats = \"json,yaml\"\r\n        securityDefinition {\r\n            json = \"/service-security.json\" // attempted with and without the leading slash \r\n        }\r\n    }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/comments/312227733","html_url":"https://github.com/gigaSproule/swagger-gradle-plugin/issues/15#issuecomment-312227733","issue_url":"https://api.github.com/repos/gigaSproule/swagger-gradle-plugin/issues/15","id":312227733,"user":{"login":"plechev","id":1397441,"avatar_url":"https://avatars0.githubusercontent.com/u/1397441?v=3","gravatar_id":"","url":"https://api.github.com/users/plechev","html_url":"https://github.com/plechev","followers_url":"https://api.github.com/users/plechev/followers","following_url":"https://api.github.com/users/plechev/following{/other_user}","gists_url":"https://api.github.com/users/plechev/gists{/gist_id}","starred_url":"https://api.github.com/users/plechev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plechev/subscriptions","organizations_url":"https://api.github.com/users/plechev/orgs","repos_url":"https://api.github.com/users/plechev/repos","events_url":"https://api.github.com/users/plechev/events{/privacy}","received_events_url":"https://api.github.com/users/plechev/received_events","type":"User","site_admin":false},"created_at":"2017-06-30T09:58:50Z","updated_at":"2017-06-30T09:58:50Z","body":"Good point. However when debugging I noticed that the class on which we call `getResourceAsStream` would not return any resource/source from the project. \r\nPerhaps an option can be added to refer to the file directly, bypassing the classloader altogether. For example: \r\n```\r\n        securityDefinition {\r\n            jsonPath = \"${project.rootDir}/service-security.json\" \r\n        }\r\n```"}}
{"actor":{"display_login":"plechev"}}