Skip to content
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

Entity generator do not ask for fieldType when no persistence #13604

Closed
henri-tremblay opened this issue Jan 19, 2021 · 16 comments · Fixed by #23877
Closed

Entity generator do not ask for fieldType when no persistence #13604

henri-tremblay opened this issue Jan 19, 2021 · 16 comments · Fixed by #23877
Milestone

Comments

@henri-tremblay
Copy link
Contributor

Overview of the issue

I have generate a project which use "No database". I'm generating an entity for it.
It used to be forbidden but in version 7.0.0-beta.0 it seems to now be allowed, which is really cool.

The following things do not work:

  1. The generator doesn't ask for any field type. The field type is undefined and the generator fails with an error
  2. Repository classes are generated
  3. Service and IT tests are referring to the repository (which causes compilation errors and a crash in prettier)
  4. The entity is annotated with @Id
Motivation for or Use Case

I want a read-only script that will present information coming from calls on other APIs.
So I don't need the persistence but having the UI and controllers is really useful.

Reproduce the error
  1. Generate a project with no persistence
  2. Create an entity
Related issues

N/A

Suggest a Fix
  • Field type should be asked. The list is probably coming from the persistence type so I suggest some hardcoded list (String, LocalDate, Integer, ...)
  • The generated code should have no JPA annotation on the entity
  • The repository classe should not be generated
  • The service should be generated without using a repository and with not content (todos, empty Optionals and empty lists)
  • The IT tests should use no repository. It could check that empty stuff is indeed returned
JHipster Version(s)

7.0.0-beta.0

JHipster configuration
{
  "generator-jhipster": {
    "blueprints": [],
    "otherModules": [],
    "applicationType": "monolith",
    "baseName": "allo",
    "jhipsterVersion": "7.0.0-beta.0",
    "skipClient": false,
    "skipServer": false,
    "skipUserManagement": true,
    "skipCheckLengthOfIdentifier": false,
    "skipFakeData": false,
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "testFrameworks": [],
    "pages": [],
    "creationTimestamp": 1611021758835,
    "promptValues": {
      "packageName": "com.mycompany.myapp",
      "nativeLanguage": "en"
    },
    "serviceDiscoveryType": false,
    "reactive": false,
    "authenticationType": "jwt",
    "packageName": "com.mycompany.myapp",
    "serverPort": "8080",
    "cacheProvider": "ehcache",
    "enableHibernateCache": false,
    "databaseType": "no",
    "buildTool": "maven",
    "serverSideOptions": [],
    "websocket": false,
    "searchEngine": false,
    "messageBroker": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "angularX",
    "withAdminUi": true,
    "clientTheme": "none",
    "enableTranslation": false,
    "nativeLanguage": "en",
    "packageFolder": "com/mycompany/myapp",
    "jwtSecretKey": "OGQ3OGFiYmExMDk2MWNjN2Q2ZDJlMDllMGEyZTJmZGUyNTc4MzA3ZDljZDcxZmQyYWI4NGYzMGYwOTBjOGI3NzY4YjkxNWU1ZTdiMTRkNmM2MTZjZTA5MzA1ZmJhMmJjMjA2MWU3NThlZmEwOTY2NzQwYzdlZTY1NzM4ZDYxZWM=",
    "devDatabaseType": "no",
    "prodDatabaseType": "no",
    "clientPackageManager": "npm",
    "clientThemeVariant": "",
    "languages": ["en", "fr"]
  }
}
Entity configuration(s) entityName.json files generated in the .jhipster directory

N/A

Browsers and Operating System

macOS Catalina

  • [ x] Checking this box is mandatory (this is just to show you read everything)
@henri-tremblay
Copy link
Contributor Author

Side comment: "languages": ["en", "fr"] is weird. I have generated without international support and English as the language.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Issue it still valid with beta-1
1- Create a project without a database
2- Add an entity (jhipster entity Item) with whatever field (e.g name)

  • No type asked
  • Error right after because of it
ERROR! fieldType is missing in .jhipster/Item.json for field {
    "fieldName": "name"
}
Error: fieldType is missing in .jhipster/Item.json for field {
    "fieldName": "name"
}
    at EntityGenerator._validateField (/.../aaa/node_modules/generator-jhipster/generators/entity/index.js:856:19)
    at /.../aaa/node_modules/generator-jhipster/generators/entity/index.js:382:26
    at Array.forEach (<anonymous>)
    at EntityGenerator.configureFields (/.../aaa/node_modules/generator-jhipster/generators/entity/index.js:376:24)
    at Object.<anonymous> (/.../aaa/node_modules/yeoman-generator/lib/index.js:991:25)
    at /.../aaa/node_modules/run-async/index.js:49:25
    at new Promise (<anonymous>)
    at /.../aaa/node_modules/run-async/index.js:26:19
    at runLoop.add.once.once (/.../aaa/node_modules/yeoman-generator/lib/index.js:992:11)
    at processImmediate (internal/timers.js:461:21)

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Still valid!

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Still valid (from as far as I know)!

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Still valid

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Still valid I think

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity.
Our core developers tend to be more verbose on denying. If there is no negative comment, possibly this feature will be accepted.
We are accepting PRs 😃.
Comment or this will be closed in 7 days

@pascalgrimaud pascalgrimaud added this to the 7.2.0 milestone Sep 11, 2021
@pascalgrimaud pascalgrimaud reopened this Jan 11, 2022
@sailokeshaithagoni
Copy link

Generating field #1

? Do you want to add a field to your entity? Yes
? What is the name of your field? userid
? Do you want to add validation rules to your field? Yes
? Which validation rules do you want to add?

================= Bp =================
Fields
userid (undefined)

Generating field #2

? Do you want to add a field to your entity? Yes
? What is the name of your field? added_timestamp
? Do you want to add validation rules to your field? No

================= Bp =================
Fields
userid (undefined)
added_timestamp (undefined)

Generating field #3

? Do you want to add a field to your entity? No

================= Bp =================
Fields
userid (undefined)
added_timestamp (undefined)

Generating relationships to other entities

? Do you want to add a relationship to another entity? No

================= Bp =================
Fields
userid (undefined)
added_timestamp (undefined)

? Do you want to use separate service class for your business logic? Yes, generate a separate service interface and implementation
? Do you want to use a Data Transfer Object (DTO)? Yes, generate a DTO with MapStruct
? Is this entity read-only? Yes
? Do you want pagination and sorting on your entity? No

Everything is configured, generating the entity...

ERROR! fieldType is missing in .jhipster/Bp.json for field {
"fieldName": "userid",
"fieldValidateRules": []
}
Error: fieldType is missing in .jhipster/Bp.json for field {
"fieldName": "userid",
"fieldValidateRules": []
}
at EntityGenerator._validateField (/home/mylogic/projects/bpbook/node_modules/generator-jhipster/generators/entity/index.js:1089:13)
at /home/mylogic/projects/bpbook/node_modules/generator-jhipster/generators/entity/index.js:454:16
at Array.forEach ()
at EntityGenerator.configureFields (/home/mylogic/projects/bpbook/node_modules/generator-jhipster/generators/entity/index.js:445:16)
at Object. (/home/mylogic/projects/bpbook/node_modules/yeoman-generator/lib/index.js:1097:23)
at /home/mylogic/projects/bpbook/node_modules/run-async/index.js:49:25
at new Promise ()
at /home/mylogic/projects/bpbook/node_modules/run-async/index.js:26:19
at /home/mylogic/projects/bpbook/node_modules/yeoman-generator/lib/index.js:1098:9
at new Promise ()

This issue is still there!!

@alina-yur
Copy link

Just ran into this as well:)

@github-actions
Copy link
Contributor

This issue is stale because it has been open for too long without any activity.
Due to the moving nature of jhipster generated application, bugs can become invalid.
If this issue still applies please comment otherwise it will be closed in 7 days

@henri-tremblay
Copy link
Contributor Author

Still valid from as far as I know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants