diff --git a/cli/commands.js b/cli/commands.js index 6aabf6556837..74f491a01f2a 100644 --- a/cli/commands.js +++ b/cli/commands.js @@ -109,8 +109,8 @@ const defaultCommands = { desc: 'Skip the user management module during app generation', }, { - option: '--unidirectional-relationships', - desc: 'Generate unidirectional relationships', + option: '--unilateral-relationships', + desc: 'Generate unilateral relationships', }, ], desc: `Create entities from the JDL file/URL/content passed in argument. diff --git a/cli/import-jdl.js b/cli/import-jdl.js index 30cdcdcabf84..9fa875046e43 100644 --- a/cli/import-jdl.js +++ b/cli/import-jdl.js @@ -344,7 +344,7 @@ class JDLProcessor { databaseType: this.options.db, applicationType: this.options.applicationType, skipUserManagement: this.options.skipUserManagement, - unidirectionalRelationships: this.options.unidirectionalRelationships, + unilateralRelationships: this.options.unilateralRelationships, generatorVersion: packagejs.version, skipFileGeneration: true, }; diff --git a/generators/entity/index.js b/generators/entity/index.js index 38bb7e92b25f..e2d1f130d8ee 100644 --- a/generators/entity/index.js +++ b/generators/entity/index.js @@ -534,7 +534,7 @@ class EntityGenerator extends BaseBlueprintGenerator { otherEntity.otherRelationships.push(relationship); if ( - relationship.unidirectional && + relationship.unilateral && (relationship.relationshipType === 'many-to-many' || // OneToOne is back reference is require due to filtering relationship.relationshipType === 'one-to-one' || diff --git a/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js b/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js index c6b1be1673b1..afcd1bef57d8 100644 --- a/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js +++ b/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js @@ -38,7 +38,7 @@ module.exports = { * @param {Array} jdlRelationships - the relationships to convert. * @param {Array} entityNames - all the entities' names. * @param {Object} convertOptions - Convert options. - * @param {Boolean} [convertOptions.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [convertOptions.unilateralRelationships] - Whether to generate unilateral relationships * @return {Map>} a map having for keys entity names and for values arrays of JSON relationships. */ function convert(jdlRelationships = [], entityNames = [], convertOptions = {}) { @@ -78,19 +78,19 @@ function getRelatedRelationships(relationships, entityNames) { } function setRelationshipsFromEntity(relatedRelationships, entityName, convertOptions) { - const { unidirectionalRelationships } = convertOptions; + const { unilateralRelationships } = convertOptions; relatedRelationships.from.forEach(relationshipToConvert => { const otherSplitField = extractField(relationshipToConvert.injectedFieldInTo); const convertedRelationship = { relationshipType: _.kebabCase(relationshipToConvert.type), otherEntityName: camelCase(relationshipToConvert.to), }; - if (!unidirectionalRelationships || otherSplitField.relationshipName) { + if (!unilateralRelationships || otherSplitField.relationshipName) { convertedRelationship.otherEntityRelationshipName = lowerFirst(otherSplitField.relationshipName) || camelCase(relationshipToConvert.from); } - if (unidirectionalRelationships) { - convertedRelationship.unidirectional = !otherSplitField.relationshipName; + if (unilateralRelationships) { + convertedRelationship.unilateral = !otherSplitField.relationshipName; } if (relationshipToConvert.isInjectedFieldInFromRequired) { convertedRelationship.relationshipValidateRules = REQUIRED; @@ -107,7 +107,7 @@ function setRelationshipsFromEntity(relatedRelationships, entityName, convertOpt convertedRelationship.ownerSide = true; } else if (relationshipToConvert.type === MANY_TO_MANY) { if (!relationshipToConvert.injectedFieldInTo) { - if (!convertOptions.unidirectionalRelationships && !builtInEntities.has(relationshipToConvert.to.toLowerCase())) { + if (!convertOptions.unilateralRelationships && !builtInEntities.has(relationshipToConvert.to.toLowerCase())) { convertedRelationship.otherEntityRelationshipName = lowerFirst(relationshipToConvert.from); const convertedOtherEntityRelationships = convertedRelationships.get(relationshipToConvert.to); const otherSideRelationship = { @@ -139,7 +139,7 @@ function setRelationshipsToEntity(relatedRelationships, entityName, convertOptio relationshipType: _.kebabCase(relationshipType), otherEntityName: camelCase(relationshipToConvert.from), }; - if (!convertOptions.unidirectionalRelationships || otherSplitField.relationshipName) { + if (!convertOptions.unilateralRelationships || otherSplitField.relationshipName) { convertedRelationship.otherEntityRelationshipName = lowerFirst(otherSplitField.relationshipName) || camelCase(relationshipToConvert.to); } diff --git a/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js b/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js index 5c51c89015f6..59ca4b9b8b52 100644 --- a/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js +++ b/jdl/converters/jdl-to-json/jdl-with-applications-to-json-converter.js @@ -38,7 +38,7 @@ module.exports = { * Converts a JDLObject to ready-to-be exported JSON entities. * @param {Object} args - the configuration object, keys: * @param {JDLObject} args.jdlObject - the JDLObject to convert to JSON - * @param {Boolean} [args.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [args.unilateralRelationships] - Whether to generate unilateral relationships * @returns {Map} entities that can be exported to JSON */ function convert(args = {}) { @@ -51,10 +51,10 @@ function convert(args = {}) { const applicationNames = jdlObject.getApplications().map(jdlApplication => jdlApplication.getConfigurationOptionValue('baseName')); return new Map(applicationNames.map(applicationName => [applicationName, []])); } - const { unidirectionalRelationships } = args; + const { unilateralRelationships } = args; setBasicEntityInformation(); setFields(); - setRelationships({ unidirectionalRelationships }); + setRelationships({ unilateralRelationships }); setApplicationToEntities(); const entitiesForEachApplication = getEntitiesForEachApplicationMap(); setOptions(entitiesForEachApplication); diff --git a/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js b/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js index c7380899c5a4..d1338326a6ca 100644 --- a/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +++ b/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js @@ -40,7 +40,7 @@ module.exports = { * @param {String} args.applicationName - the application's name * @param {String} args.databaseType - the database type * @param {string} args.applicationType - the application's type - * @param {Boolean} [args.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [args.unilateralRelationships] - Whether to generate unilateral relationships * @returns {Map} entities that can be exported to JSON */ function convert(args = {}) { @@ -48,11 +48,11 @@ function convert(args = {}) { throw new Error("The JDL object, the application's name and its the database type are mandatory."); } init(args); - const { unidirectionalRelationships } = args; + const { unilateralRelationships } = args; setBasicEntityInformation(); setOptions(); setFields(); - setRelationships({ unidirectionalRelationships }); + setRelationships({ unilateralRelationships }); setApplicationToEntities(); return new Map([[args.applicationName, Object.values(entities)]]); } diff --git a/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js b/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js index 376a9072dd29..e4c9e50ada84 100644 --- a/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js +++ b/jdl/converters/parsed-jdl-to-jdl-object/parsed-jdl-to-jdl-object-converter.js @@ -56,7 +56,7 @@ let applicationsPerEntityName; * @param {String} configurationObject.databaseType - The application's database type * @param {String} configurationObject.generatorVersion - The generator's version * @param {Boolean} configurationObject.skippedUserManagement - Whether user management is skipped - * @param {Boolean} [configurationObject.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [configurationObject.unilateralRelationships] - Whether to generate unilateral relationships * @return {JDLObject} the built JDL object. */ function parseFromConfigurationObject(configurationObject) { @@ -64,13 +64,13 @@ function parseFromConfigurationObject(configurationObject) { if (!parsedContent) { throw new Error('The parsed JDL content must be passed.'); } - const { unidirectionalRelationships } = configurationObject; + const { unilateralRelationships } = configurationObject; init(configurationObject); fillApplications(); fillDeployments(); fillEnums(); fillClassesAndFields(); - fillAssociations({ unidirectionalRelationships }); + fillAssociations({ unilateralRelationships }); fillOptions(); return jdlObject; } @@ -194,8 +194,8 @@ function getConstantValueFromConstantName(constantName) { } function fillAssociations(conversionOptions = {}) { - const { unidirectionalRelationships = configuration.databaseType === DatabaseTypes.NEO4J } = conversionOptions; - const jdlRelationships = convertRelationships(parsedContent.relationships, convertAnnotationsToOptions, { unidirectionalRelationships }); + const { unilateralRelationships = configuration.databaseType === DatabaseTypes.NEO4J } = conversionOptions; + const jdlRelationships = convertRelationships(parsedContent.relationships, convertAnnotationsToOptions, { unilateralRelationships }); jdlRelationships.forEach(jdlRelationship => { jdlObject.addRelationship(jdlRelationship, configuration.skippedUserManagement); }); diff --git a/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.js b/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.js index 6b7450dd1cfa..5d13d3944026 100644 --- a/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.js +++ b/jdl/converters/parsed-jdl-to-jdl-object/relationship-converter.js @@ -29,14 +29,14 @@ module.exports = { convertRelationships }; * @param {Array} parsedRelationships - the parsed relationships. * @param {Function} annotationToOptionConverter - the function that can convert annotations to options. * @param {Object} conversionOptions - conversion options - * @param {Boolean} conversionOptions.unidirectionalRelationships - whether to generate bidirectional one-to-many. + * @param {Boolean} conversionOptions.unilateralRelationships - whether to generate bidirectional one-to-many. * @return {Array} the converted JDL relationships. */ function convertRelationships(parsedRelationships, annotationToOptionConverter, conversionOptions = {}) { if (!parsedRelationships) { throw new Error('Relationships have to be passed so as to be converted.'); } - const { unidirectionalRelationships } = conversionOptions; + const { unilateralRelationships } = conversionOptions; return parsedRelationships.map(parsedRelationship => { const relationshipConfiguration = { from: parsedRelationship.from.name, @@ -53,7 +53,7 @@ function convertRelationships(parsedRelationships, annotationToOptionConverter, source: annotationToOptionConverter.call(undefined, parsedRelationship.options.source), destination: annotationToOptionConverter.call(undefined, parsedRelationship.options.destination), }, - unidirectionalRelationships, + unilateralRelationships, }; if (!relationshipConfiguration.injectedFieldInFrom && !relationshipConfiguration.injectedFieldInTo) { relationshipConfiguration.injectedFieldInFrom = lowerFirst(relationshipConfiguration.to); diff --git a/jdl/jdl-importer.js b/jdl/jdl-importer.js index 115eb0cf4e8c..be7e651cd110 100644 --- a/jdl/jdl-importer.js +++ b/jdl/jdl-importer.js @@ -50,7 +50,7 @@ module.exports = { * @param {String} configuration.generatorVersion - deprecated, the generator's version, optional if parsing applications * @param {String} configuration.forceNoFiltering - whether to force filtering * @param {Boolean} configuration.skipFileGeneration - whether not to generate the .yo-rc.json file - * @param {Boolean} [configuration.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [configuration.unilateralRelationships] - Whether to generate unilateral relationships * @returns {Object} a JDL importer. * @throws {Error} if files aren't passed. */ @@ -77,7 +77,7 @@ function createImporterFromFiles(files, configuration) { * @param {String} configuration.generatorVersion - deprecated, the generator's version, optional if parsing applications * @param {String} configuration.forceNoFiltering - whether to force filtering * @param {Boolean} configuration.skipFileGeneration - whether not to generate the .yo-rc.json file - * @param {Boolean} [configuration.unidirectionalRelationships] - Whether to generate unidirectional relationships + * @param {Boolean} [configuration.unilateralRelationships] - Whether to generate unilateral relationships * @param {Array} configuration.blueprints - the blueprints used. * @returns {Object} a JDL importer. * @throws {Error} if the content isn't passed. @@ -134,7 +134,7 @@ function getJDLObject(parsedJDLContent, configuration) { let applicationType = configuration.applicationType; let generatorVersion = configuration.generatorVersion; let databaseType = configuration.databaseType; - const unidirectionalRelationships = configuration.unidirectionalRelationships; + const unilateralRelationships = configuration.unilateralRelationships; let skippedUserManagement = false; if (configuration.application) { @@ -152,13 +152,13 @@ function getJDLObject(parsedJDLContent, configuration) { generatorVersion, skippedUserManagement, databaseType, - unidirectionalRelationships, + unilateralRelationships, }); } function checkForErrors(jdlObject, configuration, logger = console) { let validator; - const { unidirectionalRelationships } = configuration; + const { unilateralRelationships } = configuration; if (jdlObject.getApplicationQuantity() === 0) { let application = configuration.application; if (!application && doesFileExist('.yo-rc.json')) { @@ -191,16 +191,16 @@ function checkForErrors(jdlObject, configuration, logger = console) { blueprints, }, logger, - { unidirectionalRelationships } + { unilateralRelationships } ); } else { - validator = JDLWithApplicationValidator.createValidator(jdlObject, logger, { unidirectionalRelationships }); + validator = JDLWithApplicationValidator.createValidator(jdlObject, logger, { unilateralRelationships }); } validator.checkForErrors(); } function importOnlyEntities(jdlObject, configuration) { - const { unidirectionalRelationships } = configuration; + const { unilateralRelationships } = configuration; let { applicationName, applicationType, databaseType } = configuration; let application = configuration.application; @@ -224,14 +224,14 @@ function importOnlyEntities(jdlObject, configuration) { applicationName, applicationType, databaseType, - unidirectionalRelationships, + unilateralRelationships, }); const jsonEntities = entitiesPerApplicationMap.get(applicationName); return exportJSONEntities(jsonEntities, configuration); } function importOneApplicationAndEntities(jdlObject, configuration) { - const { skipFileGeneration, unidirectionalRelationships } = configuration; + const { skipFileGeneration, unilateralRelationships } = configuration; const importState = { exportedApplications: [], @@ -248,7 +248,7 @@ function importOneApplicationAndEntities(jdlObject, configuration) { const applicationName = jdlApplication.getConfigurationOptionValue('baseName'); const entitiesPerApplicationMap = JDLWithApplicationsToJSONConverter.convert({ jdlObject, - unidirectionalRelationships, + unilateralRelationships, }); const jsonEntities = entitiesPerApplicationMap.get(applicationName); importState.exportedApplicationsWithEntities[applicationName] = { @@ -269,7 +269,7 @@ function importOneApplicationAndEntities(jdlObject, configuration) { } function importApplicationsAndEntities(jdlObject, configuration) { - const { skipFileGeneration, unidirectionalRelationships } = configuration; + const { skipFileGeneration, unilateralRelationships } = configuration; const importState = { exportedApplications: [], @@ -285,7 +285,7 @@ function importApplicationsAndEntities(jdlObject, configuration) { } const entitiesPerApplicationMap = JDLWithApplicationsToJSONConverter.convert({ jdlObject, - unidirectionalRelationships, + unilateralRelationships, }); entitiesPerApplicationMap.forEach((jsonEntities, applicationName) => { const jdlApplication = jdlObject.getApplication(applicationName); diff --git a/jdl/models/jdl-relationship.js b/jdl/models/jdl-relationship.js index ae47bdbdd14c..abe66cc98e71 100644 --- a/jdl/models/jdl-relationship.js +++ b/jdl/models/jdl-relationship.js @@ -33,7 +33,7 @@ module.exports = class JDLRelationship { if ( merged.type === RelationshipTypes.ONE_TO_MANY && (!merged.injectedFieldInFrom || !merged.injectedFieldInTo) && - !merged.unidirectionalRelationships + !merged.unilateralRelationships ) { logger.warn( `In the One-to-Many relationship from ${merged.from} to ${merged.to}, ` + @@ -172,7 +172,7 @@ function defaults() { }, commentInFrom: '', commentInTo: '', - unidirectionalRelationships: false, + unilateralRelationships: false, }; } diff --git a/jdl/validators/jdl-with-application-validator.js b/jdl/validators/jdl-with-application-validator.js index 4204ee30013f..859ee07a35fa 100644 --- a/jdl/validators/jdl-with-application-validator.js +++ b/jdl/validators/jdl-with-application-validator.js @@ -48,7 +48,7 @@ function createValidator(jdlObject, logger = console, options = {}) { if (!jdlObject) { throw new Error('A JDL object must be passed to check for business errors.'); } - const { unidirectionalRelationships } = options; + const { unilateralRelationships } = options; return { checkForErrors: () => { @@ -60,7 +60,7 @@ function createValidator(jdlObject, logger = console, options = {}) { return; } checkForEntityErrors(jdlApplication); - checkForRelationshipErrors(jdlApplication, { unidirectionalRelationships }); + checkForRelationshipErrors(jdlApplication, { unilateralRelationships }); checkForEnumErrors(); checkDeploymentsErrors(); checkForOptionErrors(jdlApplication); @@ -144,11 +144,11 @@ function createValidator(jdlObject, logger = console, options = {}) { if (jdlObject.getRelationshipQuantity() === 0) { return; } - const { unidirectionalRelationships } = options; + const { unilateralRelationships } = options; const skippedUserManagement = jdlApplication.getConfigurationOptionValue('skipUserManagement'); const validator = new RelationshipValidator(); jdlObject.forEachRelationship(jdlRelationship => { - validator.validate(jdlRelationship, { skippedUserManagement, unidirectionalRelationships }); + validator.validate(jdlRelationship, { skippedUserManagement, unilateralRelationships }); checkForAbsentEntities({ jdlRelationship, doesEntityExist: entityName => !!jdlObject.getEntity(entityName), diff --git a/jdl/validators/jdl-without-application-validator.js b/jdl/validators/jdl-without-application-validator.js index 7c97af351b37..8b3acc049110 100644 --- a/jdl/validators/jdl-without-application-validator.js +++ b/jdl/validators/jdl-without-application-validator.js @@ -54,7 +54,7 @@ function createValidator(jdlObject, applicationSettings = {}, logger = console, if (!jdlObject) { throw new Error('A JDL object must be passed to check for business errors.'); } - const { unidirectionalRelationships } = options; + const { unilateralRelationships } = options; if (applicationSettings.blueprints && applicationSettings.blueprints.length !== 0) { return { @@ -67,7 +67,7 @@ function createValidator(jdlObject, applicationSettings = {}, logger = console, return { checkForErrors: () => { checkForEntityErrors(); - checkForRelationshipErrors({ unidirectionalRelationships }); + checkForRelationshipErrors({ unilateralRelationships }); checkForEnumErrors(); checkDeploymentsErrors(); checkForOptionErrors(); @@ -128,12 +128,12 @@ function createValidator(jdlObject, applicationSettings = {}, logger = console, if (jdlObject.getRelationshipQuantity() === 0) { return; } - const { unidirectionalRelationships } = options; + const { unilateralRelationships } = options; const skippedUserManagement = applicationSettings.skippedUserManagement || jdlObject.getOptionsForName(OptionNames.SKIP_USER_MANAGEMENT)[0]; const validator = new RelationshipValidator(); jdlObject.forEachRelationship(jdlRelationship => { - validator.validate(jdlRelationship, { skippedUserManagement, unidirectionalRelationships }); + validator.validate(jdlRelationship, { skippedUserManagement, unilateralRelationships }); checkForAbsentEntities({ jdlRelationship, doesEntityExist: entityName => !!jdlObject.getEntity(entityName), diff --git a/jdl/validators/relationship-validator.js b/jdl/validators/relationship-validator.js index aaa83fc7bc43..e453fa48494c 100644 --- a/jdl/validators/relationship-validator.js +++ b/jdl/validators/relationship-validator.js @@ -32,14 +32,14 @@ module.exports = class RelationshipValidator extends Validator { if (typeof options === 'boolean') { options = { skippedUserManagement: options }; } - const { skippedUserManagement, unidirectionalRelationships } = options; + const { skippedUserManagement, unilateralRelationships } = options; super.validate(jdlRelationship); checkType(jdlRelationship); checkInjectedFields(jdlRelationship); checkForValidUseOfJPaDerivedIdentifier(jdlRelationship); checkForRequiredReflexiveRelationship(jdlRelationship); checkForInvalidUseOfTheUserEntity(jdlRelationship, skippedUserManagement); - checkRelationshipType(jdlRelationship, { skippedUserManagement, unidirectionalRelationships }); + checkRelationshipType(jdlRelationship, { skippedUserManagement, unilateralRelationships }); } }; @@ -92,7 +92,7 @@ function checkForForbiddenUseOfUserAsSource(jdlRelationship, skippedUserManageme } function checkRelationshipType(jdlRelationship, options) { - const { skippedUserManagement, unidirectionalRelationships } = options; + const { skippedUserManagement, unilateralRelationships } = options; switch (jdlRelationship.type) { case ONE_TO_ONE: checkOneToOneRelationship(jdlRelationship); @@ -101,7 +101,7 @@ function checkRelationshipType(jdlRelationship, options) { checkManyToOneRelationship(jdlRelationship, skippedUserManagement); break; case MANY_TO_MANY: - checkManyToManyRelationship(jdlRelationship, unidirectionalRelationships); + checkManyToManyRelationship(jdlRelationship, unilateralRelationships); break; case ONE_TO_MANY: return; @@ -121,12 +121,12 @@ function checkOneToOneRelationship(jdlRelationship) { } function checkManyToOneRelationship(jdlRelationship, skippedUserManagementOption) { - const unidirectionalRelationship = !jdlRelationship.injectedFieldInFrom || !jdlRelationship.injectedFieldInTo; + const unilateralRelationship = !jdlRelationship.injectedFieldInFrom || !jdlRelationship.injectedFieldInTo; const userIsTheSourceEntity = isUserManagementEntity(jdlRelationship.from); const userIsTheDestinationEntity = isUserManagementEntity(jdlRelationship.to); const userHasTheInjectedField = (userIsTheSourceEntity && jdlRelationship.injectedFieldInFrom) || (userIsTheDestinationEntity && jdlRelationship.injectedFieldInTo); - if (unidirectionalRelationship && userHasTheInjectedField && !skippedUserManagementOption) { + if (unilateralRelationship && userHasTheInjectedField && !skippedUserManagementOption) { throw new Error( `In the Many-to-One relationship from ${jdlRelationship.from} to ${jdlRelationship.to}, ` + 'the User entity has the injected field without its management being skipped. ' + @@ -135,15 +135,15 @@ function checkManyToOneRelationship(jdlRelationship, skippedUserManagementOption } } -function checkManyToManyRelationship(jdlRelationship, unidirectionalRelationships) { +function checkManyToManyRelationship(jdlRelationship, unilateralRelationships) { const destinationEntityIsTheUser = isUserManagementEntity(jdlRelationship.to); if (jdlRelationship.injectedFieldInFrom && !jdlRelationship.injectedFieldInTo && destinationEntityIsTheUser) { // This is a valid case: even though bidirectionality is required for MtM relationships, having the destination // entity being the User is possible. return; } - const unidirectionalRelationship = !jdlRelationship.injectedFieldInFrom || !jdlRelationship.injectedFieldInTo; - if (unidirectionalRelationship && !unidirectionalRelationships) { + const unilateralRelationship = !jdlRelationship.injectedFieldInFrom || !jdlRelationship.injectedFieldInTo; + if (unilateralRelationship && !unilateralRelationships) { const injectedFieldInSourceEntity = !jdlRelationship.injectedFieldInFrom ? 'not set' : `'${jdlRelationship.injectedFieldInFrom}'`; const injectedFieldInDestinationEntity = !jdlRelationship.injectedFieldInTo ? 'not set' : `'${jdlRelationship.injectedFieldInTo}'`; throw new Error( diff --git a/test/jdl/converters/json-to-jdl-entity-converter.spec.js b/test/jdl/converters/json-to-jdl-entity-converter.spec.js index a0250b7a53ce..43a7ac631da4 100644 --- a/test/jdl/converters/json-to-jdl-entity-converter.spec.js +++ b/test/jdl/converters/json-to-jdl-entity-converter.spec.js @@ -140,7 +140,7 @@ describe('JSONToJDLEntityConverter', () => { }); context('when parsing JSON entities to JDL', () => { - it('should parse unidirectional OneToOne relationships', () => { + it('should parse unilateral OneToOne relationships', () => { expect(jdlObject.relationships.getOneToOne('OneToOne_Department{location}_Location')).not.to.be.undefined; }); it('should parse bidirectional OneToOne relationships', () => { @@ -149,7 +149,7 @@ describe('JSONToJDLEntityConverter', () => { it('should parse bidirectional OneToMany relationships', () => { expect(jdlObject.relationships.getOneToMany('OneToMany_Department{employee}_Employee{department(foo)}')).not.to.be.undefined; }); - it('should parse unidirectional ManyToOne relationships', () => { + it('should parse unilateral ManyToOne relationships', () => { expect(jdlObject.relationships.getManyToOne('ManyToOne_Employee{manager}_Employee')).not.to.be.undefined; }); it('should parse ManyToMany relationships', () => { diff --git a/test/jdl/jdl-importer.spec.js b/test/jdl/jdl-importer.spec.js index 83cc10032b4c..1d0ecb9f522f 100644 --- a/test/jdl/jdl-importer.spec.js +++ b/test/jdl/jdl-importer.spec.js @@ -1872,7 +1872,7 @@ paginate * with infinite-scroll expect(fse.existsSync('.jhipster')).to.be.false; }); }); - context('when passing the unidirectionalRelationships option', () => { + context('when passing the unilateralRelationships option', () => { const entities = ` entity A entity B @@ -1899,7 +1899,7 @@ relationship ManyToMany { before(() => { importer = createImporterFromContent(entities, { - unidirectionalRelationships: true, + unilateralRelationships: true, applicationName: 'jhipter', databaseType: 'postgresql', }); @@ -1927,7 +1927,7 @@ application { } ${entities}`, { - unidirectionalRelationships: true, + unilateralRelationships: true, } ); returned = importer.import(); @@ -1959,7 +1959,7 @@ ${entities}`, ownerSide: true, relationshipName: 'oneToOneB', relationshipType: 'one-to-one', - unidirectional: true, + unilateral: true, }, { otherEntityName: 'b', @@ -1967,40 +1967,40 @@ ${entities}`, otherEntityRelationshipName: 'biOneToOneA', relationshipName: 'biOneToOneB', relationshipType: 'one-to-one', - unidirectional: false, + unilateral: false, }, { otherEntityName: 'b', relationshipName: 'oneToManyB', relationshipType: 'one-to-many', - unidirectional: true, + unilateral: true, }, { otherEntityName: 'b', otherEntityRelationshipName: 'biOneToManyA', relationshipName: 'biOneToManyB', relationshipType: 'one-to-many', - unidirectional: false, + unilateral: false, }, { otherEntityName: 'b', relationshipName: 'manyToOneB', relationshipType: 'many-to-one', - unidirectional: true, + unilateral: true, }, { otherEntityName: 'b', otherEntityRelationshipName: 'biManyToOneA', relationshipName: 'biManyToOneB', relationshipType: 'many-to-one', - unidirectional: false, + unilateral: false, }, { otherEntityName: 'b', ownerSide: true, relationshipName: 'manyToManyB', relationshipType: 'many-to-many', - unidirectional: true, + unilateral: true, }, { otherEntityName: 'b', @@ -2008,7 +2008,7 @@ ${entities}`, otherEntityRelationshipName: 'biManyToManyA', relationshipName: 'biManyToManyB', relationshipType: 'many-to-many', - unidirectional: false, + unilateral: false, }, ]); expect(applicationWithEntities.entities[1].relationships).to.be.eql([ diff --git a/test/jdl/models/jdl-relationship.spec.js b/test/jdl/models/jdl-relationship.spec.js index ad19f5e386a1..4385040a5192 100644 --- a/test/jdl/models/jdl-relationship.spec.js +++ b/test/jdl/models/jdl-relationship.spec.js @@ -68,7 +68,7 @@ describe('JDLRelationship', () => { expect(relationship.type).to.equal(RelationshipTypes.ONE_TO_ONE); }); }); - context('when passing an unidirectional one-to-many relationship', () => { + context('when passing an unilateral one-to-many relationship', () => { context('and disabling the conversion to a bidirectional relationship', () => { let relationship; @@ -78,7 +78,7 @@ describe('JDLRelationship', () => { to: 'Abc2', injectedFieldInFrom: 'something', type: RelationshipTypes.ONE_TO_MANY, - unidirectionalRelationships: true, + unilateralRelationships: true, }); }); @@ -87,7 +87,7 @@ describe('JDLRelationship', () => { }); }); }); - context('when passing an unidirectional many-to-one relationship', () => { + context('when passing an unilateral many-to-one relationship', () => { context('and disabling the conversion to a bidirectional relationship', () => { let relationship; @@ -97,7 +97,7 @@ describe('JDLRelationship', () => { to: 'Abc2', injectedFieldInFrom: 'something', type: RelationshipTypes.MANY_TO_ONE, - unidirectionalRelationships: true, + unilateralRelationships: true, }); }); @@ -106,7 +106,7 @@ describe('JDLRelationship', () => { }); }); }); - context('when passing an unidirectional many-to-one relationship', () => { + context('when passing an unilateral many-to-one relationship', () => { context('and disabling the conversion to a bidirectional relationship', () => { let relationship; @@ -116,7 +116,7 @@ describe('JDLRelationship', () => { to: 'Abc2', injectedFieldInFrom: 'something', type: RelationshipTypes.ONE_TO_ONE, - unidirectionalRelationships: true, + unilateralRelationships: true, }); }); @@ -125,7 +125,7 @@ describe('JDLRelationship', () => { }); }); }); - context('when passing an unidirectional many-to-one relationship', () => { + context('when passing an unilateral many-to-one relationship', () => { context('and disabling the conversion to a bidirectional relationship', () => { let relationship; @@ -135,7 +135,7 @@ describe('JDLRelationship', () => { to: 'Abc2', injectedFieldInFrom: 'something', type: RelationshipTypes.MANY_TO_MANY, - unidirectionalRelationships: true, + unilateralRelationships: true, }); });