{"action":"created","issue":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4628","repository_url":"https://api.github.com/repos/jhipster/generator-jhipster","labels_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4628/labels{/name}","comments_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4628/comments","events_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4628/events","html_url":"https://github.com/jhipster/generator-jhipster/pull/4628","id":194262322,"number":4628,"title":"fix tests for entity fields with pattern","user":{"login":"kaidohallik","id":23017435,"avatar_url":"https://avatars.githubusercontent.com/u/23017435?v=3","gravatar_id":"","url":"https://api.github.com/users/kaidohallik","html_url":"https://github.com/kaidohallik","followers_url":"https://api.github.com/users/kaidohallik/followers","following_url":"https://api.github.com/users/kaidohallik/following{/other_user}","gists_url":"https://api.github.com/users/kaidohallik/gists{/gist_id}","starred_url":"https://api.github.com/users/kaidohallik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaidohallik/subscriptions","organizations_url":"https://api.github.com/users/kaidohallik/orgs","repos_url":"https://api.github.com/users/kaidohallik/repos","events_url":"https://api.github.com/users/kaidohallik/events{/privacy}","received_events_url":"https://api.github.com/users/kaidohallik/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-12-08T07:03:44Z","updated_at":"2016-12-16T09:57:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/pulls/4628","html_url":"https://github.com/jhipster/generator-jhipster/pull/4628","diff_url":"https://github.com/jhipster/generator-jhipster/pull/4628.diff","patch_url":"https://github.com/jhipster/generator-jhipster/pull/4628.patch"},"body":"fix jhipster/generator-jhipster#3100"},"comment":{"url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/comments/267558206","html_url":"https://github.com/jhipster/generator-jhipster/pull/4628#issuecomment-267558206","issue_url":"https://api.github.com/repos/jhipster/generator-jhipster/issues/4628","id":267558206,"user":{"login":"kaidohallik","id":23017435,"avatar_url":"https://avatars.githubusercontent.com/u/23017435?v=3","gravatar_id":"","url":"https://api.github.com/users/kaidohallik","html_url":"https://github.com/kaidohallik","followers_url":"https://api.github.com/users/kaidohallik/followers","following_url":"https://api.github.com/users/kaidohallik/following{/other_user}","gists_url":"https://api.github.com/users/kaidohallik/gists{/gist_id}","starred_url":"https://api.github.com/users/kaidohallik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaidohallik/subscriptions","organizations_url":"https://api.github.com/users/kaidohallik/orgs","repos_url":"https://api.github.com/users/kaidohallik/repos","events_url":"https://api.github.com/users/kaidohallik/events{/privacy}","received_events_url":"https://api.github.com/users/kaidohallik/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T09:57:52Z","updated_at":"2016-12-16T09:57:52Z","body":"So let's discuss possible solution details.\r\nShould it be in the separate file or in the same file where other Entity elements are located?\r\n\r\nIf the same file like that:\r\n```\r\n{\r\n\t\"fieldName\": \"myField\",\r\n\t\"javadoc\": \"My field.\",\r\n\t\"fieldType\": \"String\",\r\n\t\"fieldValidateRules\": [\r\n\t\t\"required\",\r\n\t\t\"maxlength\",\r\n\t\t\"pattern\"\r\n\t],\r\n\t\"fieldValidateRulesMaxlength\": 30,\r\n\t\"fieldValidateRulesPattern\": \"^[A-Za-z][A-Za-z0-9_]*$\",\r\n\t\"fieldTestValues\": [\r\n\t\t\"AFirstTestValue\",\r\n\t\t\"ASecondTestValue\"\r\n\t]\r\n}\r\n```\r\nthen declaration is compact, all in one file. But drawback is: if regenerating from JDL Studio file then test values are gone.\r\n\r\nIf separate file then there are 2 possible solutions.\r\n\r\n**Solution 1.** Use one common pattern fields test values file where test values for every entity are held. Possible file name: `.patternFieldsTestValues`\r\nPossible file structure:\r\n```\r\n{\r\n    \"entities\": [\r\n        {\r\n            \"entityName\": \"myEntity\",\r\n            \"fields\": [\r\n                {\r\n                    \"fieldName\": \"myField\",\r\n                    \"testValues\": [\r\n                        \"AFirstTestValue\",\r\n                        \"ASecondTestValue\"\r\n                    ]\r\n                },\r\n                ..........\r\n            ]\r\n        },\r\n        ..........\r\n    ]\r\n}\r\n```\r\n\r\n**Solution 2.** Use separate file for every entity. Possible file name pattern: `.EntityNameTestValues`\r\nPossible file structure:\r\n```\r\n{\r\n    \"fields\": [\r\n        {\r\n            \"fieldName\": \"myField\",\r\n            \"testValues\": [\r\n                \"AFirstTestValue\",\r\n                \"ASecondTestValue\"\r\n            ]\r\n        },\r\n        ..........\r\n    ]\r\n}\r\n```\r\n"}}
{"actor":{"display_login":"kaidohallik"}}