diff --git a/jdl/__test-files__/json_to_jdl_converter/app_with_entities/.yo-rc.json b/jdl/__test-files__/json_to_jdl_converter/app_with_entities/.yo-rc.json index 2e7c64f19ea5..f4438355b6dd 100644 --- a/jdl/__test-files__/json_to_jdl_converter/app_with_entities/.yo-rc.json +++ b/jdl/__test-files__/json_to_jdl_converter/app_with_entities/.yo-rc.json @@ -1,6 +1,6 @@ { - "entities": ["Country", "Department", "Employee", "Job", "JobHistory", "Location", "Region", "Task"], "generator-jhipster": { + "entities": ["Country", "Department", "Employee", "Job", "JobHistory", "Location", "Region", "Task"], "promptValues": { "packageName": "com.mycompany.myapp" }, diff --git a/jdl/__test-files__/json_to_jdl_converter/app_with_inconsistent_information/.yo-rc.json b/jdl/__test-files__/json_to_jdl_converter/app_with_inconsistent_information/.yo-rc.json index 0e8f4052fc69..0b81bf5cf80e 100644 --- a/jdl/__test-files__/json_to_jdl_converter/app_with_inconsistent_information/.yo-rc.json +++ b/jdl/__test-files__/json_to_jdl_converter/app_with_inconsistent_information/.yo-rc.json @@ -1,6 +1,6 @@ { - "entities": ["Country"], "generator-jhipster": { + "entities": ["Country"], "promptValues": { "packageName": "com.mycompany.myapp" }, diff --git a/jdl/converters/json-to-jdl-converter.ts b/jdl/converters/json-to-jdl-converter.ts index 05a27a16d4f4..98f58c28a764 100644 --- a/jdl/converters/json-to-jdl-converter.ts +++ b/jdl/converters/json-to-jdl-converter.ts @@ -120,7 +120,11 @@ function getJSONEntityFiles(applicationDirectory: string, yoRcFileContent: Parti const entities: Map = new Map(); fs.readdirSync(path.join(applicationDirectory, '.jhipster')).forEach(file => { const entityName = file.slice(0, file.indexOf('.json')); - if (!yoRcFileContent.entities?.includes(entityName)) { + if ( + yoRcFileContent['generator-jhipster'] && + yoRcFileContent['generator-jhipster']!.entities && + !yoRcFileContent['generator-jhipster']!.entities!.includes(entityName) + ) { throw new Error( `Mismatch identified between the application description amount of entity listed and the entity found in the .jhipster folder for entity name: ${entityName}`, ); diff --git a/jdl/converters/types.ts b/jdl/converters/types.ts index 2936f8a7e2fd..91d7c615e8fe 100644 --- a/jdl/converters/types.ts +++ b/jdl/converters/types.ts @@ -32,10 +32,36 @@ export type JSONEntity = { } & Record; export type JSONGeneratorJhipsterContent = { - applicationType: string; + baseName: string; + applicationType?: string; + entities?: string[]; + jhipsterVersion?: string; + packageName?: string; + packageFolder?: string; + serverPort?: string; + authenticationType?: string; + buildTool?: string; + cacheProvider?: string; + clientPackageManager?: string; + creationTimestamp?: number; + databaseType?: string; + devDatabaseType?: string; + enableHibernateCache?: boolean; + enableTranslation?: boolean; + jhiPrefix?: string; + jwtSecretKey?: string; + languages?: string[]; + messageBroker?: string; + nativeLanguage?: string; + prodDatabaseType?: string; + searchEngine?: string; + serviceDiscoveryType?: string; + skipClient?: boolean; + skipUserManagement?: boolean; + testFrameworks: string[]; + websocket: string; } & Record; export type JSONRootObject = { - entities: string[]; ['generator-jhipster']: JSONGeneratorJhipsterContent; };