jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.5k stars 4.02k forks source link

Make jdl/entity generator not touch unrelated entities #19328

Closed psk788 closed 9 months ago

psk788 commented 2 years ago
Overview of the issue

Running any entity create/update will generate changelogs for unrelated entities. It should only generate change logs for the entity in question and any related entities (example one to many related entity)

Documentation says:

By default jdl regenerates only entities which have changed, if you want all your entities to be regenerated then pass in the --force flag. Please note that this will overwrite all your local changes to the entity files

which doesnt seem to be working

Motivation for or Use Case

If i want to create a new entity or update an existing one either through the entity creator or jdl, it generates change logs for every other entity and forces me to either tediously answer y/n for every file modified or accept all and revert unneeeded changes.

Reproduce the error
  1. Have an existing app with existing entities
  2. Create a new jdl and add a new entity without relationships OR use the entity sub generator to create a new entity without relationships
  3. observe the generator generating changelogs for every entity and not just ones scoped to the jdl/generator
Related issues

Could not find this issue elsewhere

Suggest a Fix

Regardless of changelog timestamp or which entities are defined in .yo-rc.json, the generator should only update entities which are in the jdl barring a specific flag/command to regenerate everything.

JHipster Version(s)

7.7.0

JHipster configuration
Jhipster info
     ##### **JHipster Version(s)**

```
xxxxxxx@0.0.11 /Users/Patrick/git/xxxxxx
└── generator-jhipster@7.7.0

```

##### **Environment and Tools**

openjdk version "11.0.14" 2022-01-18 LTS
OpenJDK Runtime Environment Zulu11.54+23-CA (build 11.0.14+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.54+23-CA (build 11.0.14+9-LTS, mixed mode)

git version 2.32.0 (Apple Git-132)

node: v16.14.0

npm: 8.3.1

Docker version 20.10.12, build e91ed5707e

Docker Compose version v2.5.0

  
Yo-rc
     {
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "xxxxxxxx",
    "blueprints": [],
    "buildTool": "maven",
    "cacheProvider": "ehcache",
    "clientFramework": "react",
    "clientPackageManager": "npm",
    "clientTheme": "lux",
    "clientThemeVariant": "dark",
    "creationTimestamp": 1649703400832,
    "databaseType": "sql",
    "devDatabaseType": "h2Memory",
    "devServerPort": 9060,
    "dtoSuffix": "DTO",
    "enableGradleEnterprise": false,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": false,
    "enableTranslation": false,
    "entities": [
      "Compound",
      "CompoundBatch",
      "Plate",
      "TestUiEntity"
    ],
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.7.0",
    "languages": ["en", "fr"],
    "lastLiquibaseTimestamp": 1658933772000,
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "com.xxx.xxxxxxx",
    "pages": [],
    "prodDatabaseType": "mysql",
    "reactive": false,
    "searchEngine": "elasticsearch",
    "serverPort": "8080",
    "serverSideOptions": ["searchEngine:elasticsearch"],
    "serviceDiscoveryType": "no",
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "skipUserManagement": true,
    "testFrameworks": ["cypress"],
    "websocket": false,
    "withAdminUi": true
  }
}

  
JDL definitions

enum PassFail {
  PASS (Passed),
  FAIL (Failed)
}

entity TestUiEntity{
   stringField String,
   intField Integer,
   longField Long,
   bigDecimalField BigDecimal,
   floatField Float,
   doubleField Double,
    booleanField Boolean,
    enumField PassFail,
    localDateField LocalDate,
    zonedDateTimeField ZonedDateTime,
    instantField Instant,
    durationField Duration,
    imageBlobField ImageBlob,
    textBlobField TextBlob

}

filter TestUiEntity

  
Browsers and Operating System

Mac BigSur 11.6.3

mraible commented 2 years ago

@psk788 Are you able to contribute a PR for this feature? Contributing is one thing, maintaining it for years to come is another. Choose wisely.

github-actions[bot] commented 9 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days