{"action":"created","comment":{"url":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments/217724265","pull_request_review_id":155510102,"id":217724265,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNzcyNDI2NQ==","diff_hunk":"@@ -0,0 +1,97 @@\n+---\n+lang: en\n+title: 'Repository generator'\n+keywords: LoopBack 4.0, LoopBack 4\n+sidebar: lb4_sidebar\n+permalink: /doc/en/lb4/Repository-generator.html\n+---\n+\n+{% include content/generator-create-app.html lang=page.lang %}\n+\n+### Synopsis\n+\n+Adds a new [Repository or Multiple Repositories](Repositories.md) class to a\n+LoopBack application with one single command.\n+\n+### Notes\n+\n+The optional argument `[<name>]`, referes to a valid datasource already created","path":"docs/site/Repository-generator.md","position":18,"original_position":18,"commit_id":"07780ba0224bc9c98dedf92cee164b01543dcdf1","original_commit_id":"07780ba0224bc9c98dedf92cee164b01543dcdf1","user":{"login":"bajtos","id":1140553,"node_id":"MDQ6VXNlcjExNDA1NTM=","avatar_url":"https://avatars1.githubusercontent.com/u/1140553?v=4","gravatar_id":"","url":"https://api.github.com/users/bajtos","html_url":"https://github.com/bajtos","followers_url":"https://api.github.com/users/bajtos/followers","following_url":"https://api.github.com/users/bajtos/following{/other_user}","gists_url":"https://api.github.com/users/bajtos/gists{/gist_id}","starred_url":"https://api.github.com/users/bajtos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bajtos/subscriptions","organizations_url":"https://api.github.com/users/bajtos/orgs","repos_url":"https://api.github.com/users/bajtos/repos","events_url":"https://api.github.com/users/bajtos/events{/privacy}","received_events_url":"https://api.github.com/users/bajtos/received_events","type":"User","site_admin":false},"body":"Maybe your generator should be inheriting from a different base generator class?","created_at":"2018-09-14T14:05:07Z","updated_at":"2018-09-14T14:05:08Z","html_url":"https://github.com/strongloop/loopback-next/pull/1659#discussion_r217724265","pull_request_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments/217724265"},"html":{"href":"https://github.com/strongloop/loopback-next/pull/1659#discussion_r217724265"},"pull_request":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659"}},"in_reply_to_id":217689048},"pull_request":{"url":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659","id":212127350,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMTI3MzUw","html_url":"https://github.com/strongloop/loopback-next/pull/1659","diff_url":"https://github.com/strongloop/loopback-next/pull/1659.diff","patch_url":"https://github.com/strongloop/loopback-next/pull/1659.patch","issue_url":"https://api.github.com/repos/strongloop/loopback-next/issues/1659","number":1659,"state":"open","locked":false,"title":"feat(cli): lb4 repository implementation","user":{"login":"marioestradarosa","id":4633823,"node_id":"MDQ6VXNlcjQ2MzM4MjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4633823?v=4","gravatar_id":"","url":"https://api.github.com/users/marioestradarosa","html_url":"https://github.com/marioestradarosa","followers_url":"https://api.github.com/users/marioestradarosa/followers","following_url":"https://api.github.com/users/marioestradarosa/following{/other_user}","gists_url":"https://api.github.com/users/marioestradarosa/gists{/gist_id}","starred_url":"https://api.github.com/users/marioestradarosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marioestradarosa/subscriptions","organizations_url":"https://api.github.com/users/marioestradarosa/orgs","repos_url":"https://api.github.com/users/marioestradarosa/repos","events_url":"https://api.github.com/users/marioestradarosa/events{/privacy}","received_events_url":"https://api.github.com/users/marioestradarosa/received_events","type":"User","site_admin":false},"body":"**Done**\r\n- **Filtering** out the _soap and rest connectors_ from the data source list\r\n- Inferring the repository class (**KV** or **CRUD**) based on the connector property for JSON datasource\r\n- Allow _multiple selection_ of models \r\n- Infers the **id property name** from the model Class based on _3 scenarios_\r\n   - The current template generated by `lb4 model` command \r\n   - A JSON object inside the @model decorator\r\n   - A JSON definition inside the class model\r\n- **Prompts for the property name i**n case the infer process _couldn't find the primary key property_\r\n- Currently it is generating the repository based on the two repository types (KV or CRUD)\r\n- support for --config is inherited from the base generators \r\n- properly display an error message if it can't fine a src/datasources or src/models directory\r\n- Add basic documentation for the feature\r\n\r\n**Command line feature**\r\n- Now we can supply the arguments from the command line. The arguments are checked against all the artifacts implemented already (ie: id inferring list, datasource list, model list) and if not valid, it falls back to the prompt. \r\n\r\n**Syntax**: _Use them interchangeably_\r\n`lb4 repository <datasourceName> --model  --id`\r\n\r\n**Example:** \r\n`lb4 repository dbmem --model=pluto --id=IDPK`\r\n\r\nIt will generate the repository for pluto with id property name IDPK. It is checked if dbmem is a valid datasource, pluto (changed to Pluto) is a valid model and if its id can't be inferred then it falls back to use the id argument supplied. All validations are performed against the list of artifacts already loaded form their respective directories.\r\n\r\n### Test Status\r\n- [x] Test on Default generated models  using CRUD connector\r\n- [x] Test on models defined by @model decorator using CRUD connector\r\n- [x] Test on Default  generated models using KV connector\r\n- [x] Test on models defined by @model decorator using KV connector\r\n- [x] Test on failing providing or selecting a model. \r\n   - at this point the user should have selected a valid datasource, otherwise this point will never get reached\r\n- [x] Test on multi-word models\r\n- [x] Test on command line interface --model --id from a none-id inferred model file\r\n- [x] Test failing  when the datasource list is empty.\r\n   -  the datasources are not KV or CRUD, and thus it returns an empty list\r\n   -  or the datasource directory is empty\r\n- [x] Add test for supporting config file \r\n\r\n### Preconditions checked\r\ncheck the following directories in this order\r\n\r\n- check if the src/datasources exists, displaying an approriate error\r\n- check if the src/models exists \r\n\r\nImplements #1588\r\n\r\n## Checklist\r\n\r\n- [x] `npm test` passes on your machine\r\n- [x] New tests added or existing tests modified to cover all changes\r\n- [x] Code conforms with the [style guide](http://loopback.io/doc/en/contrib/style-guide.html)\r\n- [ ] API Documentation in code was updated\r\n- [ ] Documentation in [/docs/site](../tree/master/docs/site) was updated\r\n- [x] Affected artifact templates in `packages/cli` were updated\r\n- [ ] Affected example projects in `examples/*` were updated\r\n","created_at":"2018-08-30T15:49:48Z","updated_at":"2018-09-14T14:05:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a1393bff702e90790b54bbad42af6ed3bed39da","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659/commits","review_comments_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659/comments","review_comment_url":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments{/number}","comments_url":"https://api.github.com/repos/strongloop/loopback-next/issues/1659/comments","statuses_url":"https://api.github.com/repos/strongloop/loopback-next/statuses/07780ba0224bc9c98dedf92cee164b01543dcdf1","head":{"label":"marioestradarosa:feat-add-lb-repository","ref":"feat-add-lb-repository","sha":"07780ba0224bc9c98dedf92cee164b01543dcdf1","user":{"login":"marioestradarosa","id":4633823,"node_id":"MDQ6VXNlcjQ2MzM4MjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4633823?v=4","gravatar_id":"","url":"https://api.github.com/users/marioestradarosa","html_url":"https://github.com/marioestradarosa","followers_url":"https://api.github.com/users/marioestradarosa/followers","following_url":"https://api.github.com/users/marioestradarosa/following{/other_user}","gists_url":"https://api.github.com/users/marioestradarosa/gists{/gist_id}","starred_url":"https://api.github.com/users/marioestradarosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marioestradarosa/subscriptions","organizations_url":"https://api.github.com/users/marioestradarosa/orgs","repos_url":"https://api.github.com/users/marioestradarosa/repos","events_url":"https://api.github.com/users/marioestradarosa/events{/privacy}","received_events_url":"https://api.github.com/users/marioestradarosa/received_events","type":"User","site_admin":false},"repo":{"id":140765710,"node_id":"MDEwOlJlcG9zaXRvcnkxNDA3NjU3MTA=","name":"loopback-next","full_name":"marioestradarosa/loopback-next","owner":{"login":"marioestradarosa","id":4633823,"node_id":"MDQ6VXNlcjQ2MzM4MjM=","avatar_url":"https://avatars0.githubusercontent.com/u/4633823?v=4","gravatar_id":"","url":"https://api.github.com/users/marioestradarosa","html_url":"https://github.com/marioestradarosa","followers_url":"https://api.github.com/users/marioestradarosa/followers","following_url":"https://api.github.com/users/marioestradarosa/following{/other_user}","gists_url":"https://api.github.com/users/marioestradarosa/gists{/gist_id}","starred_url":"https://api.github.com/users/marioestradarosa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marioestradarosa/subscriptions","organizations_url":"https://api.github.com/users/marioestradarosa/orgs","repos_url":"https://api.github.com/users/marioestradarosa/repos","events_url":"https://api.github.com/users/marioestradarosa/events{/privacy}","received_events_url":"https://api.github.com/users/marioestradarosa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marioestradarosa/loopback-next","description":"LoopBack makes it easy to build modern API applications that require complex integrations.","fork":true,"url":"https://api.github.com/repos/marioestradarosa/loopback-next","forks_url":"https://api.github.com/repos/marioestradarosa/loopback-next/forks","keys_url":"https://api.github.com/repos/marioestradarosa/loopback-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marioestradarosa/loopback-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marioestradarosa/loopback-next/teams","hooks_url":"https://api.github.com/repos/marioestradarosa/loopback-next/hooks","issue_events_url":"https://api.github.com/repos/marioestradarosa/loopback-next/issues/events{/number}","events_url":"https://api.github.com/repos/marioestradarosa/loopback-next/events","assignees_url":"https://api.github.com/repos/marioestradarosa/loopback-next/assignees{/user}","branches_url":"https://api.github.com/repos/marioestradarosa/loopback-next/branches{/branch}","tags_url":"https://api.github.com/repos/marioestradarosa/loopback-next/tags","blobs_url":"https://api.github.com/repos/marioestradarosa/loopback-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marioestradarosa/loopback-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marioestradarosa/loopback-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/marioestradarosa/loopback-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marioestradarosa/loopback-next/statuses/{sha}","languages_url":"https://api.github.com/repos/marioestradarosa/loopback-next/languages","stargazers_url":"https://api.github.com/repos/marioestradarosa/loopback-next/stargazers","contributors_url":"https://api.github.com/repos/marioestradarosa/loopback-next/contributors","subscribers_url":"https://api.github.com/repos/marioestradarosa/loopback-next/subscribers","subscription_url":"https://api.github.com/repos/marioestradarosa/loopback-next/subscription","commits_url":"https://api.github.com/repos/marioestradarosa/loopback-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/marioestradarosa/loopback-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/marioestradarosa/loopback-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/marioestradarosa/loopback-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/marioestradarosa/loopback-next/contents/{+path}","compare_url":"https://api.github.com/repos/marioestradarosa/loopback-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marioestradarosa/loopback-next/merges","archive_url":"https://api.github.com/repos/marioestradarosa/loopback-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marioestradarosa/loopback-next/downloads","issues_url":"https://api.github.com/repos/marioestradarosa/loopback-next/issues{/number}","pulls_url":"https://api.github.com/repos/marioestradarosa/loopback-next/pulls{/number}","milestones_url":"https://api.github.com/repos/marioestradarosa/loopback-next/milestones{/number}","notifications_url":"https://api.github.com/repos/marioestradarosa/loopback-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marioestradarosa/loopback-next/labels{/name}","releases_url":"https://api.github.com/repos/marioestradarosa/loopback-next/releases{/id}","deployments_url":"https://api.github.com/repos/marioestradarosa/loopback-next/deployments","created_at":"2018-07-12T21:18:50Z","updated_at":"2018-09-13T23:23:29Z","pushed_at":"2018-09-14T02:46:37Z","git_url":"git://github.com/marioestradarosa/loopback-next.git","ssh_url":"git@github.com:marioestradarosa/loopback-next.git","clone_url":"https://github.com/marioestradarosa/loopback-next.git","svn_url":"https://github.com/marioestradarosa/loopback-next","homepage":"http://loopback.io","size":8285,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"strongloop:master","ref":"master","sha":"f5cd06969c7b2e6c9a38ffeb078ca68e274a9216","user":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"repo":{"id":78452015,"node_id":"MDEwOlJlcG9zaXRvcnk3ODQ1MjAxNQ==","name":"loopback-next","full_name":"strongloop/loopback-next","owner":{"login":"strongloop","id":3020012,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjAwMTI=","avatar_url":"https://avatars1.githubusercontent.com/u/3020012?v=4","gravatar_id":"","url":"https://api.github.com/users/strongloop","html_url":"https://github.com/strongloop","followers_url":"https://api.github.com/users/strongloop/followers","following_url":"https://api.github.com/users/strongloop/following{/other_user}","gists_url":"https://api.github.com/users/strongloop/gists{/gist_id}","starred_url":"https://api.github.com/users/strongloop/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/strongloop/subscriptions","organizations_url":"https://api.github.com/users/strongloop/orgs","repos_url":"https://api.github.com/users/strongloop/repos","events_url":"https://api.github.com/users/strongloop/events{/privacy}","received_events_url":"https://api.github.com/users/strongloop/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/strongloop/loopback-next","description":"LoopBack makes it easy to build modern API applications that require complex integrations.","fork":false,"url":"https://api.github.com/repos/strongloop/loopback-next","forks_url":"https://api.github.com/repos/strongloop/loopback-next/forks","keys_url":"https://api.github.com/repos/strongloop/loopback-next/keys{/key_id}","collaborators_url":"https://api.github.com/repos/strongloop/loopback-next/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/strongloop/loopback-next/teams","hooks_url":"https://api.github.com/repos/strongloop/loopback-next/hooks","issue_events_url":"https://api.github.com/repos/strongloop/loopback-next/issues/events{/number}","events_url":"https://api.github.com/repos/strongloop/loopback-next/events","assignees_url":"https://api.github.com/repos/strongloop/loopback-next/assignees{/user}","branches_url":"https://api.github.com/repos/strongloop/loopback-next/branches{/branch}","tags_url":"https://api.github.com/repos/strongloop/loopback-next/tags","blobs_url":"https://api.github.com/repos/strongloop/loopback-next/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/strongloop/loopback-next/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/strongloop/loopback-next/git/refs{/sha}","trees_url":"https://api.github.com/repos/strongloop/loopback-next/git/trees{/sha}","statuses_url":"https://api.github.com/repos/strongloop/loopback-next/statuses/{sha}","languages_url":"https://api.github.com/repos/strongloop/loopback-next/languages","stargazers_url":"https://api.github.com/repos/strongloop/loopback-next/stargazers","contributors_url":"https://api.github.com/repos/strongloop/loopback-next/contributors","subscribers_url":"https://api.github.com/repos/strongloop/loopback-next/subscribers","subscription_url":"https://api.github.com/repos/strongloop/loopback-next/subscription","commits_url":"https://api.github.com/repos/strongloop/loopback-next/commits{/sha}","git_commits_url":"https://api.github.com/repos/strongloop/loopback-next/git/commits{/sha}","comments_url":"https://api.github.com/repos/strongloop/loopback-next/comments{/number}","issue_comment_url":"https://api.github.com/repos/strongloop/loopback-next/issues/comments{/number}","contents_url":"https://api.github.com/repos/strongloop/loopback-next/contents/{+path}","compare_url":"https://api.github.com/repos/strongloop/loopback-next/compare/{base}...{head}","merges_url":"https://api.github.com/repos/strongloop/loopback-next/merges","archive_url":"https://api.github.com/repos/strongloop/loopback-next/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/strongloop/loopback-next/downloads","issues_url":"https://api.github.com/repos/strongloop/loopback-next/issues{/number}","pulls_url":"https://api.github.com/repos/strongloop/loopback-next/pulls{/number}","milestones_url":"https://api.github.com/repos/strongloop/loopback-next/milestones{/number}","notifications_url":"https://api.github.com/repos/strongloop/loopback-next/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/strongloop/loopback-next/labels{/name}","releases_url":"https://api.github.com/repos/strongloop/loopback-next/releases{/id}","deployments_url":"https://api.github.com/repos/strongloop/loopback-next/deployments","created_at":"2017-01-09T17:27:14Z","updated_at":"2018-09-14T03:43:26Z","pushed_at":"2018-09-14T12:35:55Z","git_url":"git://github.com/strongloop/loopback-next.git","ssh_url":"git@github.com:strongloop/loopback-next.git","clone_url":"https://github.com/strongloop/loopback-next.git","svn_url":"https://github.com/strongloop/loopback-next","homepage":"http://loopback.io","size":8248,"stargazers_count":812,"watchers_count":812,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":89,"mirror_url":null,"archived":false,"open_issues_count":244,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":89,"open_issues":244,"watchers":812,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659"},"html":{"href":"https://github.com/strongloop/loopback-next/pull/1659"},"issue":{"href":"https://api.github.com/repos/strongloop/loopback-next/issues/1659"},"comments":{"href":"https://api.github.com/repos/strongloop/loopback-next/issues/1659/comments"},"review_comments":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659/comments"},"review_comment":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/strongloop/loopback-next/pulls/1659/commits"},"statuses":{"href":"https://api.github.com/repos/strongloop/loopback-next/statuses/07780ba0224bc9c98dedf92cee164b01543dcdf1"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"bajtos"}}