jhipster / jhipster-core

JHipster Domain Language, used by JHipster UML and JDL-Studio to generate entities
Apache License 2.0
346 stars 116 forks source link

Entities that have custom attributes in JSON entity files are always reported as changed #367

Closed murdos closed 4 years ago

murdos commented 4 years ago
Overview of the issue

Since entity merge on JDL import has been added (https://github.com/jhipster/jhipster-core/commit/d39e15f0e584318c20e70caffe1ce57769ab5f1c) the import-jdl command always considers entities that have custom attributes in JSON entity files has changed. However once the json file is rewritten, nothing has changed.

Motivation for or Use Case

Entity not changed is reported as changed, and this triggers the whole entity generation in generator-jhipster.

Reproduce the error

Put the following json in a file named MyEntity.json in your .jhipster folder (you can note the custom attribute "enableEntityAudit": false):

{
    "name": "MyEntity",
    "fields": [
        {
            "fieldName": "myField",
            "fieldType": "String"
        }
    ],
    "relationships": [],
    "changelogDate": "20190918211301",
    "entityTableName": "my_entity",
    "dto": "no",
    "pagination": "no",
    "service": "no",
    "jpaMetamodelFiltering": false,
    "fluentMethods": true,
    "clientRootFolder": "myapp",
    "applications": "*",
    "microserviceName": "myapp",
    "enableEntityAudit": false
}

Import the following JDL:

entity MyEntity { myField String }

The entity will be reported as changed, but the json file won't change.

Related issues
Suggest a Fix

I'll add a PR.

JHipster Version(s)

6.3.0

JHipster configuration
Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System