{ "id": "173119", "key": "ALOY-1649", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2019-03-12T11:41:28.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [], "versions": [ { "id": "20470", "name": "Alloy 1.13.8", "archived": false, "released": true, "releaseDate": "2019-02-11" } ], "issuelinks": [], "assignee": { "name": "batman", "key": "batman", "displayName": "Bruce Wayne", "active": true, "timeZone": "America/New_York" }, "updated": "2019-03-12T20:00:35.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "12329", "name": "Runtime", "description": "Generic bucket for uncategorized runtime issues" } ], "description": "h5.Description\r\n\r\nCalling {{createModel()}} or {{createCollection()}} where the argument is prefixed with a leading slash, or the model is in a directory. This looks to be down to the uppercasing of models done by Alloy on the create call.\r\n\r\n{code}\r\n// Controller creation\r\nrunCode('Controller', 'test/name');\r\nrunCode('Controller', '/test/name');\r\nrunCode('Controller', 'name');\r\nrunCode('Controller', '/name');\r\n// Collection creation\r\nrunCode('Collection', 'test/people');\r\nrunCode('Collection', '/test/people');\r\nrunCode('Collection', 'othermodel');\r\nrunCode('Collection', '/othermodel');\r\n// Model creation\r\nrunCode('Model', 'test/people');\r\nrunCode('Model', '/test/people');\r\nrunCode('Model', 'othermodel');\r\nrunCode('Model', '/othermodel');\r\n\r\n$.index.open();\r\n\r\nfunction runCode(type, path) {\r\n\ttry {\r\n\t\tconst functionName = `create${type}`;\r\n\t\tconst thing = Alloy[functionName](path);\r\n\t\tconsole.log(`Made ${type} with ${path}`);\r\n\t} catch (error) {\r\n\t\tconsole.error(error);\r\n\t\tconsole.error(`${type} with ${path} threw`)\r\n\t}\r\n}\r\n{code}\r\n\r\nh5.Steps to reproduce\r\n\r\n1. Create the following files\r\n** {{controllers/name.js}}\r\n** {{controllers/test/name.js}}\r\n** {{models/othermodel.js}}\r\n** {{models/test/people.js}}\r\n2. Add the code above to your {{controllers/index.js}} file\r\n3. Run on any device or sim\r\n\r\nh5.Actual\r\n\r\nLogs like below\r\n\r\n{code}\r\n[INFO] Made Controller with test/name\r\n[INFO] Made Controller with /test/name\r\n[INFO] Made Controller with name\r\n[INFO] Made Controller with /name\r\n[ERROR] Couldn't find module: /alloy/models/Test/people for architecture: x86_64\r\n[ERROR] Collection with test/people threw\r\n[ERROR] Couldn't find module: /alloy/models//test/people for architecture: x86_64\r\n[ERROR] Collection with /test/people threw\r\n[INFO] No config.adapter.idAttribute specified for table \"othermodel\"\r\n[INFO] Adding \"alloy_id\" to uniquely identify rows\r\n[INFO] Made Collection with othermodel\r\n[ERROR] Couldn't find module: /alloy/models//othermodel for architecture: x86_64\r\n[ERROR] Collection with /othermodel threw\r\n[ERROR] Couldn't find module: /alloy/models/Test/people for architecture: x86_64\r\n[ERROR] Model with test/people threw\r\n[ERROR] Couldn't find module: /alloy/models//test/people for architecture: x86_64\r\n[ERROR] Model with /test/people threw\r\n[INFO] Made Model with othermodel\r\n[ERROR] Couldn't find module: /alloy/models//othermodel for architecture: x86_64\r\n[ERROR] Model with /othermodel threw\r\n{code}\r\n\r\nh5.Expected\r\n\r\nLogging should have no \"x with y threw\" error logs", "attachment": [], "flagged": false, "summary": "Creating a collection or model with leading slash throw error on require", "creator": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "subtasks": [], "reporter": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "environment": null, "comment": { "comments": [ { "id": "446784", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "A note from when I was playing around with testing this, I don't think models are actually supported in folders by Alloy, so part of this might be irrelevant", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2019-03-12T20:00:35.000+0000", "updated": "2019-03-12T20:00:35.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }