generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

Documentation states "no" as valid value for "search" in JDL but throws error when using

Open psk788 opened this issue 3 years ago • 0 comments

Overview of the issue

The documentation for JDL options (https://www.jhipster.tech/jdl/options) states that "no" is a valid value for search annotation. The use case is if I don't want search enabled for a particular entity but also don't want to use the "search * with elasticsearch except C" format because it is a separate jdl and want to keep it isolated. image image

Motivation for or Use Case

I would like to use a separate jdl to create a different group of entities and would like to avoid having to use the "except" format or having to rollback dozens of other files on generating the new entities

Reproduce the error
  1. Enable elasticsearch in your application
  2. Create a jdl and annotate an entity with @search(no)
  3. Try to execute the jdl with jhipster import-jdl
ERROR! Error during import-jdl: The 'search' option is not valid for value 'no'.
Error: Error during import-jdl: The 'search' option is not valid for value 'no'.
    at module.exports (/Users/Patrick/git/proteoexplorer/node_modules/generator-jhipster/cli/import-jdl.js:528:27)
    at /Users/Patrick/git/proteoexplorer/node_modules/generator-jhipster/cli/jdl.js:62:49
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async JHipsterCommand.parseAsync (/Users/Patrick/git/proteoexplorer/node_modules/generator-jhipster/node_modules/commander/lib/command.js:915:5)
Patrick@mac-C02FJ20RQ05N:~/git/proteoexplorer(data-visualization*)[1]$ 
Suggest a Fix

Either make the feature functional (having @search(no) or @search(false) not have search enabled on the entity) or remove "no" from the possible values column in the documentation

JHipster Version(s)

7.7.0

JHipster configuration

jhipster info

<details>
<summary>.yo-rc.json file</summary>
<pre>
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "xxxxxxxxx",
    "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",
      "MSRun"
    ],
    "entitySuffix": "",
    "jhiPrefix": "jhi",
    "jhipsterVersion": "7.7.0",
    "languages": ["en", "fr"],
    "lastLiquibaseTimestamp": 1657742388000,
    "messageBroker": false,
    "nativeLanguage": "en",
    "otherModules": [],
    "packageName": "xxxxxxxxxxx",
    "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
  }
}

</pre>
</details>

JDL

JDL definitions
     @readOnly
@search(no)
entity MassErrorRtPlot (v_mass_error_rt)
{
    msrunId Long,
    proteomicsRunCode String,
    rt BigDecimal,
    fdr BigDecimal,
}
  
Browsers and Operating System

Mac M1 Big Sur 11.6.3

  • [X ] Checking this box is mandatory (this is just to show you read everything)

psk788 avatar Jul 14 '22 15:07 psk788