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

Cannot make relationship with user using skipUserManagement #432

Closed EnmanuelReyes closed 4 years ago

EnmanuelReyes commented 4 years ago
Overview of the issue

Cannot add any relationship with user entity having the option skipUserManagement enabled.

Error: Can't add invalid relationship. Error: Relationships from the User entity is not supported in the declaration between 'User' and 'RequestForm'. You can have this by using the 'skipUserManagement' option. Error while parsing applications and entities from the JDL Error: Can't add invalid relationship. Error: Relationships from the User entity is not supported in the declaration between 'User' and 'RequestForm'. You can have this by using the 'skipUserManagement' option.

Stacktrace: Error: Can't add invalid relationship. Error: Relationships from the User entity is not supported in the declaration between 'User' and 'RequestForm'. You can have this by using the 'skipUserManagement' option. at ValidatedJDLObject.addRelationship (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/jhipster-core/lib/core/validated_jdl_object.js:102:13) at fillAssociations (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/jhipster-core/lib/parsers/document_parser.js:289:15) at Object.parseFromConfigurationObject (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/jhipster-core/lib/parsers/document_parser.js:67:3) at getJDLObject (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/jhipster-core/lib/jdl/jdl_importer.js:110:25) at Object.import (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/jhipster-core/lib/jdl/jdl_importer.js:88:25) at JDLProcessor.importJDL (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/generator-jhipster/cli/import-jdl.js:70:41) at JDLProcessor.importJDL (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/generator-jhipster/cli/import-jdl.js:298:38) at module.exports (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/generator-jhipster/cli/import-jdl.js:465:21) at Command.command.allowUnknownOption.description.action.args (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/generator-jhipster/cli/cli.js:71:36) at Command.listener (/Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app/node_modules/generator-jhipster/node_modules/commander/index.js:315:8)

Motivation for or Use Case

If I have that option enabled, it should allow me to make a relationship with User without problems.

Reproduce the error
  1. Enable the skipUserManagement
  2. Try to make a relationship between any custom entity and the User entity.
Suggest a Fix

I have been looking in the stacktrace, most calls to validate the relationship are like this one:

Screen Shot 2020-02-20 at 11 44 59 AM

As you can see, It doesn't pass the value of the skipUserManagement option, whilst the validator method waits for it.

Screen Shot 2020-02-20 at 11 46 21 AM
JHipster Version(s)
backoffice@0.0.1-SNAPSHOT /Users/enmanuelreyes/Documents/Software/silver_night/backoffice-app
└── generator-jhipster@6.5.1 
JHipster configuration, a .yo-rc.json file generated in the root folder
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "nativeLanguage": "es"
    },
    "jhipsterVersion": "6.5.1",
    "applicationType": "monolith",
    "baseName": "backoffice",
    "useSass": true,
    "clientPackageManager": "npm",
    "clientFramework": "angularX",
    "clientTheme": "materia",
    "clientThemeVariant": "primary",
    "authenticationType": "true",
    "cacheProvider": "no",
    "databaseType": "mssql",
    "devDatabaseType": "no",
    "prodDatabaseType": "no",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": true,
    "nativeLanguage": "es",
    "languages": [
      "es",
      "en"
    ],
    "blueprints": [],
    "skipServer": true,
    "skipUserManagement": true
  }
}

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

User entity name is reserved if skipUserManagement is not set. ERROR! Error: Error while parsing entities to JDL

Browsers and Operating System

MacOS Catalina

pascalgrimaud commented 4 years ago

I don't understand well the issue. You don't want all the code related to User entity, but you still want to have a relationship with User ? How is it possible ?

MathieuAA commented 4 years ago

From what you've provided, I'll try to reproduce it!

mshima commented 4 years ago

@EnmanuelReyes are implementing a custom User entity?

EnmanuelReyes commented 4 years ago

@EnmanuelReyes are implementing a custom User entity?

Yes

EnmanuelReyes commented 4 years ago

I don't understand well the issue. You don't want all the code related to User entity, but you still want to have a relationship with User ? How is it possible ?

That should be possible if you generated the User entity.

mshima commented 4 years ago

That should be possible if you generated the User entity.

It should.

cbornet commented 4 years ago

Can't you just define and generate your own User entity ?

MathieuAA commented 4 years ago

@EnmanuelReyes you should have provided a JDL sample, that could have avoided a lot of questions :) I'm writing tests right now for this bug to test combinations, and try to reproduce it.