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

@search(elasticsearch) throws error on import #360

Closed ruddell closed 5 years ago

ruddell commented 5 years ago
Overview of the issue

The @search(elasticsearch) annotation throws an error if you try to import it.

INFO! The JDL is being parsed.
Error: The option's name and value must be valid to create an option, got value 'elasticsearch' for 'search'.
Error while parsing applications and entities from the JDL Error: The option's name and value must be valid to create an option, got value 'elasticsearch' for 'search'.
Error: The option's name and value must be valid to create an option, got value 'elasticsearch' for 'search'.
    at new JDLBinaryOption (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/core/jdl_binary_option.js:35:13)
    at annotations.forEach.annotation (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/parsers/document_parser.js:217:9)
    at Array.forEach (<anonymous>)
    at addOptionsForEntityFromAnnotations (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/parsers/document_parser.js:204:15)
    at fillClassAndItsFields (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/parsers/document_parser.js:199:5)
    at fillClassesAndFields (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/parsers/document_parser.js:161:5)
    at Object.parseFromConfigurationObject (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/parsers/document_parser.js:67:3)
    at getJDLObject (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/jdl/jdl_importer.js:86:25)
    at JDLImporter.import (/Users/ruddell/Contrib/generator-jhipster/node_modules/jhipster-core/lib/jdl/jdl_importer.js:65:23)
    at JDLProcessor.importJDL (/Users/ruddell/Contrib/generator-jhipster/cli/import-jdl.js:76:41)
Motivation for or Use Case

Originally reported on Stack Overflow: https://stackoverflow.com/q/57842696/3737815

It is one of the documented annotations so it should work.

Reproduce the error

Import the following JDL

application {
  config {
    baseName test
    searchEngine elasticsearch
  }
  entities *
}

@search(elasticsearch)
entity Actividad {
    nombre String
}
Related issues

Annotations added in https://github.com/jhipster/jhipster-core/issues/225

Suggest a Fix

Have not looked into a fix

JHipster Version(s)

Tested with master, and v6.2.0

JHipster configuration

Use the JDL from above

Entity configuration(s) entityName.json files generated in the .jhipster directory

Use the JDL from above

Browsers and Operating System
node: v10.16.0
npm: 6.10.1
MathieuAA commented 5 years ago

Roger that!

MathieuAA commented 5 years ago

Ah this is bad!! I can't believe this wasn't caught before, this is a big one as it never could have worked before. Luckily this just involves a patch release...

MathieuAA commented 5 years ago

Or not. This is going to be a major this time. I don't think I can avoid it