-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue on Front side when using skipClient for some entities #13305
Comments
@kaidohallik @mshima Issue related with: relationship OneToMany { And in original jdl I have also declared to skip some entities: But on the 'jhipster info' it did not appears! |
I tried the same config with Vue. Vue compiles successfully, but the same error occurs in runtime in Vue after entering to page that includes this import, this model is not generated also in Vue client. |
If the jdl works on jhipster 6, then it’s because of the flatten dto. |
In this case we should try to support single side relationships:
And drop back reference. |
cc @MathieuAA |
FYI: if I look at Vue source then there is also used |
After discussing with @MathieuAA about this, here my opinion:
So if I understand well, we should do a new option: I think it's faster to generate everything (without skipping client), and then:
skipClient and skipServer are for very advanced use cases. It can't work out of the box, you need to modify the generated code. |
I’m in favor of supporting single sided relationships. |
@DanielFran can you confirm if manually removing Notice relationship from |
@pascalgrimaud There is in fact 2 possibilities:
What ever solution chosen, both backend and front-end should build. @mshima In my case I wan't to include in front-end a list of notices in drug page detail. |
Not sure about that. When using skipClient + skipServer, it's not supposed to work out of the box. You always need to do some work after generating that. But we can discuss about it of course :) |
This issue is stale because it has been open 30 days with no activity. |
I have the same issue. I've created a simple example to reproduce it. Here is the JDL:
The generated Code with the error: import { IXyz } from 'app/entities/xyz/xyz.model'; // Error
export interface IAbc {
id?: number;
name?: string;
children?: IXyz[] | null; // Error
}
export class Abc implements IAbc {
constructor(public id?: number, public name?: string, public children?: IXyz[] | null) {}
} Is it possible to fix this? |
|
This doesn't work. The generator overwrites the json files and regenerates the faulty model files. |
This issue is stale because it has been open 30 days with no activity. |
This is issue is still relevant to me. |
Frankly if the PR #14461 is for this issue, I'm against it. cc @mshima for the same reasons @pascalgrimaud explained. edit: I see it still has the "needs-discussion" label too. |
@MathieuAA I didn't implemented to fix this issue, but for:
I would implement a blueprint to remove back references for personal use but there is no way to differ autogenerated back references. |
And according to the documentation https://www.jhipster.tech/managing-relationships/ unidirectional ARE supported. https://www.jhipster.tech/managing-relationships/#a-unidirectional-many-to-one-relationship So IMO this should be provided by default, not only optional like the PR implements. |
It can easily be done at JDL level. I agree unidirectional rels are supported, I'm not saying the opposite :) do keep in mind that I very probably wrote the doc you're referencing ;) Here, I just don't see how implementing it would solve this issue's issue. I may need to read it all over again. |
It doesn't actually fixes the this issue, but adds a way to workaround it by changing from:
to:
A fix would be to skip the relationship if the otherEntity is |
Overview of the issue
Issue with declaration of model on front for entities that have been skipped
Motivation for or Use Case
On front-end, it is declared model for all one-to-many entities but some of them are defined to be 'skipped' on the front side.
[INFO] ERROR Failed to compile with 1 errors12:11:41
[INFO]
[INFO] error
[INFO]
[INFO] src/main/webapp/app/entities/symptom/symptom.model.ts:1:31 - error TS2307: Cannot find module 'app/entities/toxicity-rate/toxicity-rate.model' or its corresponding type declarations.
[INFO]
[INFO] 1 import { IToxicityRate } from 'app/entities/toxicity-rate/toxicity-rate.model';
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[INFO] src/main/webapp/app/entities/drug/drug.model.ts:1:25 - error TS2307: Cannot find module 'app/entities/notice/notice.model' or its corresponding type declarations.
[INFO]
[INFO] 1 import { INotice } from 'app/entities/notice/notice.model';
[INFO] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JHipster Version(s)
Using main branch.
JHipster configuration
JHipster Version(s)
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
Environment and Tools
java version "11.0.8" 2020-07-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.8+10-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode)
git version 2.24.1.windows.2
node: v14.15.1
npm: 6.14.9
yeoman: 3.1.1
Docker version 20.10.0, build 7287ab3
docker-compose version 1.27.4, build 40524192
identical .jhipster\Administration.json
identical .jhipster\Content.json
identical .jhipster\Document.json
identical .jhipster\Drug.json
identical .jhipster\Feedback.json
identical .jhipster\Notice.json
identical .jhipster\Outcome.json
identical .jhipster\Symptom.json
identical .jhipster\TherapeuticRegime.json
identical .jhipster\ToxicityRate.json
identical .jhipster\Treatment.json
INFO! Congratulations, JHipster execution is complete!- [ ] Checking this box is mandatory (this is just to show you read everything)
The text was updated successfully, but these errors were encountered: