{"id":16316526,"url":"https://github.com/alwarg/ember-mirage-gen","last_synced_at":"2025-10-25T17:30:44.640Z","repository":{"id":55001371,"uuid":"313592113","full_name":"AlwarG/ember-mirage-gen","owner":"AlwarG","description":"The addon will give the complete mirage section after receiving the network call","archived":false,"fork":false,"pushed_at":"2021-01-17T06:04:54.000Z","size":475,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-31T09:34:21.479Z","etag":null,"topics":["database","ember","ember-cli","ember-mirage-gen","factories","fixtures"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlwarG.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-17T11:01:54.000Z","updated_at":"2021-12-15T05:05:53.000Z","dependencies_parsed_at":"2022-08-14T08:40:48.914Z","dependency_job_id":null,"html_url":"https://github.com/AlwarG/ember-mirage-gen","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlwarG%2Fember-mirage-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlwarG%2Fember-mirage-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlwarG%2Fember-mirage-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlwarG%2Fember-mirage-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlwarG","download_url":"https://codeload.github.com/AlwarG/ember-mirage-gen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183762,"owners_count":19430184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","ember","ember-cli","ember-mirage-gen","factories","fixtures"],"created_at":"2024-10-10T22:04:53.591Z","updated_at":"2025-10-25T17:30:44.281Z","avatar_url":"https://github.com/AlwarG.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"ember-mirage-gen\n==============================================================================\n\nThe addon will give the complete Mirage section after receiving the API call.\n\nDemo\n------------------------------------------------------------------------------\nDemo is available \u003ca href=\"https://alwarg.github.io/mirage-gen-demo/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003ehere\u003c/a\u003e\n\u003cbr\u003e\n![mirage-gen-common](https://i.imgur.com/Lfsx51V.png)\n\nInstallation\n------------------------------------------------------------------------------\n\n```\nember install ember-mirage-gen\n```\nCompatibility\n------------------------------------------------------------------------------\n\n* Ember.js v2.18 or above\n* Ember CLI v2.13 or above\n\nDocumentation\n------------------------------------------------------------------------------\n\nConsider we have the following sample response for the particular request\n```javascript\n  request = 'https://sample/studentdata';\n  response = {\n            student: {\n                'personal-data': {\n                  name: 'myname',\n                  age: 12\n                },\n                'educational-data': {\n                   marks: 98,\n                   section: 'B'\n                }\n             } \n            }\n```\nThe output for this response as\n![mirage-gen-option](https://i.imgur.com/X2pIfgr.png)\n\nAs shown in the above image, we have the section of the object tree. Here, we can select the type of the node. The types are\n  1. Fixture\n  2. Factory\n  3. Normal\n\n  After selecting the option, we should click the `Generate Info` button.\n\n  Note: if the node is normal, then it will be included in the config file section\n\n![mirage-gen-api](https://i.imgur.com/5PBVm0m.png)\n### Info strucure\n  Here, we have three sections\n  1. config file\n  2. DataBase\n  3. Test file\n#### 1) config file:\n This file has the API endpoints.\n ```javascript\n    this.get('your request', function(schema, request) {\n       return your response;\n    })\n ```\n #### 2) DataBase\n  This section contains a list of fixtures and factories which are chosen in the previous section.\n  Here, we can also compare our result with the available `factory/fixture` and generate the new results. For more info try it in the \u003ca href=\"https://alwarg.github.io/mirage-gen-demo/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003edemo\u003c/a\u003e page.\n \n#### 3) Test file\n  It has the creation list of factories as well as fixtures like in the Ember test file.\n\nComparison\n------------------------------------------------------------------------------\nSometimes we are not able to parse the object for comparison.\n\nExample:\n\n```javascript\n import { Factory, faker } from 'ember-cli-mirage';\n\n let myFactory = Factory.extend({\n   id() {\n     return faker.random.number();\n   },\n   myNumber() {\n     return faker.random.number();\n   }\n });\n\n  export default myFactory;\n```\nFor good parsing kindly add the code as below\n```javascript\nimport { Factory, faker } from 'ember-cli-mirage';\n\nlet myFactory = Factory.extend(\n  // $MirageSection-Start$\n  {\n    id() {\n      return faker.random.number();\n    },\n    myNumber() {\n      return faker.random.number();\n    }\n  }\n  // $MirageSection-End$\n);\n\nexport default myFactory;\n```\nUsage\n------------------------------------------------------------------------------\n\n1. Add the following code in the application.hbs\n```\n  \u003cMirageGen @top=\"value\" @left=\"value\" /\u003e\n```\n2. In your config/environment.js, add an ember-mirage-gen object as below.\n```javascript\n// config/environment.js\nlet ENV = {\n  'ember-mirage-gen': {\n    isEnabled: environment === 'development', // Mandatory\n    isOnlyForCurrentDomain: true, // optional\n    excludedNodes: [] // optional\n  }\n};\n```\n* isEnabled - it works only when this node is true\n\n* isOnlyForCurrentDomain - Allow only the same domain API's.\n\n* excludedNodes - sometimes we got the same node for all responses and we don't need the mirage information for those nodes. So, we can exclude those nodes by adding those nodes in this array. example: **page-info** conatins page information\n\n3. Visit the app and click the `mirage-gen` icon, you will see the list of API's\n\nContributing\n------------------------------------------------------------------------------\n\nSee the [Contributing](CONTRIBUTING.md) guide for details.\n\n\nLicense\n------------------------------------------------------------------------------\n\nThis project is licensed under the [MIT License](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwarg%2Fember-mirage-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falwarg%2Fember-mirage-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falwarg%2Fember-mirage-gen/lists"}