Closed fmatuszewski closed 8 years ago
I confirm this. Im pushing a fix now
I don't understand the problem, when you say latest trunk verion 1.3.0
you mean this is only in the master branch?
As @deepu105 you seem to understand the issue I'm eager to see what you coded!!
I should do a new release tomorrow, so if this is major let's correct this before!
I guess its a small glitch as we rely on the microserviceName
on the json file from microservice to determine whether to skip server or not. and the entity JSON here doesnt have that filed, so Im ensuring we set skipServer properly and not just by relying on theis param. Im also checking why this param was not updated when the json was generated. Will push soon
Sorry, I didn't see this came from the JDL -> yes that was a bug with JHipster UML, which indeed wasn't setting the microserviceName. I thought that was corrected.
You need the microserviceName when generating the entity in the gateway, so we know the URL to point to in the AngularJS service (it's the route to the microservice). So basically, JHipster UML must correctly set this microserviceName -> it's a bug in JHipster UML, not the JHipster generator itself
might be but when regenrating the entity in the microservice it should have been set if not defined and that might be our bug, im checking that
Isn't this a duplicate with #3532 ?
yes, and I have pushed a proper handling for this
It would be great if during entity generation from microservice some validation is done and error message is shown that parameter is missing when we require it instead of silently generating the code. It would be easier to debug provblem in the future.
Yes I have pushed exactly that. now an error message will be thown
Hello there is another reason for that and I think I found it. From the user perspective it looks like this:
then in writeEntityJson in 1433 all data is set from microservice Faq.json and writeEntityJson: function () { if (this.useConfigurationFile && this.updateEntity === 'regenerate') { updateEntity is not equal 'regenerate' so this file is written once again in gateway
But I can't find where skipServer is set to false again.
yo jhipster:entity Faq
The entity Faq is being created.
? Do you want to generate this entity from an existing microservice? Yes ? Enter the path to the microservice root directory: ../m_application
Found the .jhipster/Faq.json configuration file, entity can be automatically generated!
? Do you want to update the entity? This will replace the existing files for this entity, all your custom code will be overwritten (Use arrow keys) ❯ Yes, re generate the entity [BETA] Yes, add more fields and relationships [BETA] Yes, remove fields and relationships No, exit
Yes and this behavior is intended. You are using an existing file and hence should select regenerate or add/remove option. The generated code will not work without the microserviceName
so the real issue is that it is missing in the entity.json. If you add it manually everything will work properly.
Please @shijomj don't spam the ticket system, this is the second time today
Overview of the issue
given jhipster gateway project jhipster microservice application with entities imported from jdl file
m_application.jdl
entity Faq { category String, title String, description String } entity Icon { className String } entity Language { name String languageCode String } entity Comments { comment String, rating Integer }
when I use entity generator yo jhipster:entity Faq and I choose to generate antity from microservice. ? Do you want to generate this entity from an existing microservice? Yes ? Enter the path to the microservice root directory: ../m_application
then backend domain objects are created. and gateway is not using proxy. create .jhipster/Faq.json create src/main/java/me/zubi/domain/Faq.java create src/main/java/me/zubi/repository/FaqRepository.java create src/main/java/me/zubi/web/rest/FaqResource.java create src/main/resources/config/liquibase/changelog/20160504204041_added_entity_Faq.xml
Motivation for or Use Case
According to jhipster documentation
Jhipster should proxy request to microservice. but instead backend and frontend objects are regenerated as in monolithic application
JHipster Version(s)
latest trunk verion 1.3.0
JHipster configuration, a
.yo-rc.json
file generated in the root folderfor gateway { "generator-jhipster": { "jhipsterVersion": "3.1.0", "baseName": "g_web", "packageName": "me.zubi", "packageFolder": "me/zubi", "serverPort": "9090", "authenticationType": "jwt", "hibernateCache": "hazelcast", "clusteredHttpSession": "no", "websocket": "no", "databaseType": "sql", "devDatabaseType": "h2Disk", "prodDatabaseType": "postgresql", "searchEngine": "no", "buildTool": "gradle", "jwtSecretKey": "f185e308961d3e2ff1375221ff8a5732cb250e45", "useSass": false, "applicationType": "gateway", "testFrameworks": [ "gatling", "protractor" ], "jhiPrefix": "jhi", "enableTranslation": true, "nativeLanguage": "en", "languages": [ "en", "pl", "pt-br" ], "enableSocialSignIn": true } }
for microservice { "generator-jhipster": { "jhipsterVersion": "3.1.0", "baseName": "m_application", "packageName": "me.zubi", "packageFolder": "me/zubi", "serverPort": "8081", "authenticationType": "jwt", "hibernateCache": "no", "databaseType": "mongodb", "devDatabaseType": "mongodb", "prodDatabaseType": "mongodb", "searchEngine": "no", "buildTool": "gradle", "jwtSecretKey": "f185e308961d3e2ff1375221ff8a5732cb250e45", "enableTranslation": true, "applicationType": "microservice", "testFrameworks": [ "gatling" ], "jhiPrefix": "jhi", "skipClient": true, "skipUserManagement": true, "nativeLanguage": "en", "languages": [ "en", "pl" ], "clusteredHttpSession": "no", "websocket": "no", "enableSocialSignIn": false } }
Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryentity from microservice application Faq.json
{ "relationships": [], "fields": [ { "fieldId": 1, "fieldName": "category", "fieldType": "String" }, { "fieldId": 2, "fieldName": "title", "fieldType": "String" }, { "fieldId": 3, "fieldName": "description", "fieldType": "String" } ], "changelogDate": "20160504204041", "dto": "no", "pagination": "no", "service": "no", "javadoc": "Application-Microservice" }
Browsers and Operating System
not applicable
Reproduce the error
create microservice generate Faq create gateway import Faq with entity subgenerator to gateway
Related issues
N/A
Suggest a Fix
Not Yet