{"action":"created","issue":{"url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/107","repository_url":"https://api.github.com/repos/kogosoftwarellc/open-api","labels_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/107/labels{/name}","comments_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/107/comments","events_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/107/events","html_url":"https://github.com/kogosoftwarellc/open-api/issues/107","id":324749556,"number":107,"title":"Example without api-routes folder","user":{"login":"lukiano","id":686213,"avatar_url":"https://avatars3.githubusercontent.com/u/686213?v=4","gravatar_id":"","url":"https://api.github.com/users/lukiano","html_url":"https://github.com/lukiano","followers_url":"https://api.github.com/users/lukiano/followers","following_url":"https://api.github.com/users/lukiano/following{/other_user}","gists_url":"https://api.github.com/users/lukiano/gists{/gist_id}","starred_url":"https://api.github.com/users/lukiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukiano/subscriptions","organizations_url":"https://api.github.com/users/lukiano/orgs","repos_url":"https://api.github.com/users/lukiano/repos","events_url":"https://api.github.com/users/lukiano/events{/privacy}","received_events_url":"https://api.github.com/users/lukiano/received_events","type":"User","site_admin":false},"labels":[{"id":923385173,"url":"https://api.github.com/repos/kogosoftwarellc/open-api/labels/express-openapi","name":"express-openapi","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-20T22:51:21Z","updated_at":"2018-05-22T08:05:17Z","closed_at":"2018-05-22T04:31:21Z","author_association":"NONE","body":"Hi, I'm looking for an example where the paths are defined in the .yaml file, instead of being in a folder, and the handlers are manually added later to Express. Thanks"},"comment":{"url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/comments/390900256","html_url":"https://github.com/kogosoftwarellc/open-api/issues/107#issuecomment-390900256","issue_url":"https://api.github.com/repos/kogosoftwarellc/open-api/issues/107","id":390900256,"user":{"login":"lukiano","id":686213,"avatar_url":"https://avatars3.githubusercontent.com/u/686213?v=4","gravatar_id":"","url":"https://api.github.com/users/lukiano","html_url":"https://github.com/lukiano","followers_url":"https://api.github.com/users/lukiano/followers","following_url":"https://api.github.com/users/lukiano/following{/other_user}","gists_url":"https://api.github.com/users/lukiano/gists{/gist_id}","starred_url":"https://api.github.com/users/lukiano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukiano/subscriptions","organizations_url":"https://api.github.com/users/lukiano/orgs","repos_url":"https://api.github.com/users/lukiano/repos","events_url":"https://api.github.com/users/lukiano/events{/privacy}","received_events_url":"https://api.github.com/users/lukiano/received_events","type":"User","site_admin":false},"created_at":"2018-05-22T08:05:17Z","updated_at":"2018-05-22T08:05:17Z","author_association":"NONE","body":"Typescript:\r\n```\r\nconst apidef = jsYaml.safeLoad(descriptor) as openapi.OpenApi.ApiDefinition;\r\n        const paths = new Array<openapi.OpenApi.RouteSpecification>();\r\n        if (apidef.paths) {\r\n          for (const key of Object.keys(apidef.paths)) {\r\n            const pathItemObject = apidef.paths[key];\r\n            const module: openapi.PathModule = {};\r\n            for (const method of Object.keys(pathItemObject) as Array<keyof openapi.OpenApi.PathItemObject>) {\r\n              if (method !== '$ref' && method !== 'parameters') {\r\n                module[method] = (_req, _res, next) => next();\r\n              }\r\n            }\r\n            paths.push({\r\n              path: key,\r\n              module\r\n            });\r\n          }\r\n        }\r\n        openapi.initialize({\r\n          app: this._router,\r\n          apiDoc: apidef,\r\n          exposeApiDocs: true,\r\n          docsPath: '/api.html',\r\n          paths\r\n        });\r\n```"}}
{"actor":{"display_login":"lukiano"}}