diff --git a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java index 1edba97675aed9668eddfb980de0f18768f54652..a5cf787cd4e539c3836ba885599fe6b8b5429877 100644 --- a/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java +++ b/src/main/java/fr/inra/oresing/rest/ApplicationConfigurationService.java @@ -93,8 +93,11 @@ public class ApplicationConfigurationService { if (variableComponentDescription != null) { Configuration.CheckerDescription checkerDescription = variableComponentDescription.getChecker(); if ("Reference".equals(checkerDescription.getName())) { - if (checkerDescription.getParams().containsKey(ReferenceLineChecker.PARAM_REFTYPE)) { - // OK + if (checkerDescription.getParams()!=null && checkerDescription.getParams().containsKey(ReferenceLineChecker.PARAM_REFTYPE)) { + String refType = checkerDescription.getParams().get(ReferenceLineChecker.PARAM_REFTYPE); + if(!references.contains(refType)){ + builder.unknownReferenceForChecker(dataType, datum, component, refType, references); + } } else { builder.missingReferenceForChecker(dataType, datum, component, references); } @@ -125,27 +128,34 @@ public class ApplicationConfigurationService { VariableComponentKey timeScopeVariableComponentKey = dataTypeDescription.getAuthorization().getTimeScope(); if (timeScopeVariableComponentKey == null) { builder.recordMissingTimeScopeVariableComponentKey(dataType); + } else { + if (timeScopeVariableComponentKey.getVariable() == null) { + builder.recordTimeScopeVariableComponentKeyMissingVariable(dataType, variables); + } else { + if (!dataTypeDescription.getData().containsKey(timeScopeVariableComponentKey.getVariable())) { + builder.recordTimeScopeVariableComponentKeyUnknownVariable(timeScopeVariableComponentKey, variables); + } else { + if (timeScopeVariableComponentKey.getComponent() == null) { + builder.recordTimeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); + } else { + if (!dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().containsKey(timeScopeVariableComponentKey.getComponent())) { + builder.recordTimeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); + } else { + Configuration.CheckerDescription timeScopeVariableComponentChecker = dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().get(timeScopeVariableComponentKey.getComponent()).getChecker(); + if (timeScopeVariableComponentChecker == null || !"Date".equals(timeScopeVariableComponentChecker.getName())) { + builder.recordTimeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); + } + String pattern = timeScopeVariableComponentChecker.getParams().get(DateLineChecker.PARAM_PATTERN); + if (!LocalDateTimeRange.getKnownPatterns().contains(pattern)) { + builder.recordTimeScopeVariableComponentPatternUnknown(timeScopeVariableComponentKey, pattern, LocalDateTimeRange.getKnownPatterns()); + } + } + } + } + } } - if (timeScopeVariableComponentKey.getVariable() == null) { - builder.recordTimeScopeVariableComponentKeyMissingVariable(dataType, variables); - } - if (!dataTypeDescription.getData().containsKey(timeScopeVariableComponentKey.getVariable())) { - builder.recordTimeScopeVariableComponentKeyUnknownVariable(timeScopeVariableComponentKey, variables); - } - if (timeScopeVariableComponentKey.getComponent() == null) { - builder.recordTimeVariableComponentKeyMissingComponent(dataType, timeScopeVariableComponentKey.getVariable(), dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); - } - if (!dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().containsKey(timeScopeVariableComponentKey.getComponent())) { - builder.recordTimeVariableComponentKeyUnknownComponent(timeScopeVariableComponentKey, dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().keySet()); - } - Configuration.CheckerDescription timeScopeVariableComponentChecker = dataTypeDescription.getData().get(timeScopeVariableComponentKey.getVariable()).getComponents().get(timeScopeVariableComponentKey.getComponent()).getChecker(); - if (timeScopeVariableComponentChecker == null || !"Date".equals(timeScopeVariableComponentChecker.getName())) { - builder.recordTimeScopeVariableComponentWrongChecker(timeScopeVariableComponentKey, "Date"); - } - String pattern = timeScopeVariableComponentChecker.getParams().get(DateLineChecker.PARAM_PATTERN); - if (!LocalDateTimeRange.getKnownPatterns().contains(pattern)) { - builder.recordTimeScopeVariableComponentPatternUnknown(timeScopeVariableComponentKey, pattern, LocalDateTimeRange.getKnownPatterns()); - } + + Multiset<String> variableOccurrencesInDataGroups = TreeMultiset.create(); for (Map.Entry<String, Configuration.DataGroupDescription> dataGroupEntry : dataTypeDescription.getAuthorization().getDataGroups().entrySet()) { diff --git a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java index 6e1d6e8ae59b737cda10e8b11c6c6cbaa4dd803c..08ceab192f68ce06866e641c94711e3f55f1f30d 100644 --- a/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java +++ b/src/main/java/fr/inra/oresing/rest/ConfigurationParsingResult.java @@ -73,6 +73,14 @@ public class ConfigurationParsingResult { "references", references)); } + public Builder unknownReferenceForChecker(String dataType, String datum, String component, String refType, Set<String> references) { + return recordError("unknownReferenceForChecker", ImmutableMap.of("dataType", dataType, + "datum", datum, + "refType", refType, + "component", component, + "references", references)); + } + public Builder recordUndeclaredDataGroupForVariable(String variable) { return recordError("undeclaredDataGroupForVariable", ImmutableMap.of("variable", variable)); } diff --git a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java index 223e20218ca11aa7568b0c9e5f2d31592479a56b..bcfa90c351b7268c9977260f0c2d26327ffb3335 100644 --- a/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java +++ b/src/test/java/fr/inra/oresing/rest/ApplicationConfigurationServiceTest.java @@ -41,35 +41,255 @@ public class ApplicationConfigurationServiceTest { private ApplicationConfigurationService service; @Test - public void parseConfigurationFile() throws IOException { + public void parseConfigurationFile() { ImmutableSet.of( fixtures.getMonsoreApplicationConfigurationResourceName(), fixtures.getAcbbApplicationConfigurationResourceName(), - fixtures.getHauteFrequenceApplicationConfigurationResourceName() + fixtures.getHauteFrequenceApplicationConfigurationResourceName(), + fixtures.getValidationApplicationConfigurationResourceName() ).forEach(resource -> { try (InputStream in = getClass().getResourceAsStream(resource)) { byte[] bytes = in.readAllBytes(); ConfigurationParsingResult configurationParsingResult = service.parseConfigurationBytes(bytes); + log.debug("résultat de la validation de " + resource, configurationParsingResult); Assert.assertTrue(resource + " doit être reconnu comme un fichier valide",configurationParsingResult.isValid()); } catch (IOException e) { throw new OreSiTechnicalException("ne peut pas lire le fichier de test " + resource, e); } }); - Assert.assertFalse(service.parseConfigurationBytes("".getBytes(StandardCharsets.UTF_8)).isValid()); Assert.assertFalse(service.parseConfigurationBytes("vers: 0".getBytes(StandardCharsets.UTF_8)).isValid()); Assert.assertFalse(service.parseConfigurationBytes("version: 1".getBytes(StandardCharsets.UTF_8)).isValid()); Assert.assertFalse(service.parseConfigurationBytes("::".getBytes(StandardCharsets.UTF_8)).isValid()); + } - try (InputStream in = getClass().getResourceAsStream(fixtures.getMonsoreApplicationConfigurationResourceName())) { - String yaml = IOUtils.toString(in, StandardCharsets.UTF_8); - String wrongYaml = yaml.replace("firstRowLine: 5", "firstRowLine: pas_un_chiffre"); + private ConfigurationParsingResult parseYaml(String toReplace, String by) { + ConfigurationParsingResult configurationParsingResult; + try (InputStream configurationFile = getClass().getResourceAsStream(fixtures.getValidationApplicationConfigurationResourceName())) { + String yaml = IOUtils.toString(configurationFile, StandardCharsets.UTF_8); + String wrongYaml = yaml.replace(toReplace, by); byte[] bytes = wrongYaml.getBytes(StandardCharsets.UTF_8); - ConfigurationParsingResult configurationParsingResult = service.parseConfigurationBytes(bytes); - System.out.println(configurationParsingResult); - Assert.assertFalse(configurationParsingResult.isValid()); - ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); - Assert.assertTrue(onlyError.getMessageParams().containsValue("pas_un_chiffre")); + configurationParsingResult = service.parseConfigurationBytes(bytes); + return configurationParsingResult; + } catch (IOException e) { + throw new OreSiTechnicalException("impossible de lire le fichier de test", e); } } + + @Test + public void testEmptyFile() { + byte[] bytes = "".getBytes(StandardCharsets.UTF_8); + ConfigurationParsingResult configurationParsingResult = service.parseConfigurationBytes(bytes); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("emptyFile", onlyError.getMessage()); + } + + @Test + public void testMissingReferenceForChecker() { + ConfigurationParsingResult configurationParsingResult = parseYaml("refType: sites",""); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("missingReferenceForChecker", onlyError.getMessage()); + } + + @Test + public void testUnknownReferenceForChecker() { + ConfigurationParsingResult configurationParsingResult = parseYaml("refType: sites","refType: sitee"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("unknownReferenceForChecker", onlyError.getMessage()); + } + + @Test + public void testUnsupportedVersion() { + ConfigurationParsingResult configurationParsingResult = parseYaml("version: 0", "version: -1"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("unsupportedVersion", onlyError.getMessage()); + } + + @Test + public void testUndeclaredDataGroupForVariable() { + ConfigurationParsingResult configurationParsingResult = parseYaml("data:\n" + + " - localization", "data:\n" + + " - localizations"); + Assert.assertFalse(configurationParsingResult.isValid()); + long count = configurationParsingResult.getValidationCheckResults() + .stream() + .map(ValidationCheckResult::getMessage) + .filter(mes -> mes.equals("unknownVariablesInDataGroup") || mes.equals("undeclaredDataGroupForVariable")) + .count(); + Assert.assertEquals(2, count); + } + + @Test + public void testVariableInMultipleDataGroup() { + ConfigurationParsingResult configurationParsingResult = parseYaml("data:\n" + + " - Couleur des individus","data:\n" + + " - localization\n" + + " - Couleur des individus"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("variableInMultipleDataGroup", onlyError.getMessage()); + } + + @Test + public void testMissingTimeScopeVariableComponentKey() { + ConfigurationParsingResult configurationParsingResult = parseYaml("component: site\n" + + " timeScope:\n" + + " variable: date\n" + + " component: day","component: site\n"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("missingTimeScopeVariableComponentKey", onlyError.getMessage()); + } + + @Test + public void testTimeScopeVariableComponentKeyMissingVariable() { + ConfigurationParsingResult configurationParsingResult = parseYaml("timeScope:\n" + + " variable: date\n" + + " component: day","timeScope:\n" + + " component: day"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeScopeVariableComponentKeyMissingVariable", onlyError.getMessage()); + } + + @Test + public void testTimeScopeVariableComponentKeyUnknownVariable() { + ConfigurationParsingResult configurationParsingResult = parseYaml("timeScope:\n" + + " variable: date\n" + + " component: day","timeScope:\n" + + " variable: dates\n" + + " component: day"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeScopeVariableComponentKeyUnknownVariable", onlyError.getMessage()); + } + + @Test + public void testTimeVariableComponentKeyMissingComponent() { + ConfigurationParsingResult configurationParsingResult = parseYaml("timeScope:\n" + + " variable: date\n" + + " component: day","timeScope:\n" + + " variable: date\n" + + " component: ~"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeVariableComponentKeyMissingComponent", onlyError.getMessage()); + } + + @Test + public void testTimeVariableComponentKeyUnknownComponent() { + ConfigurationParsingResult configurationParsingResult = parseYaml("timeScope:\n" + + " variable: date\n" + + " component: day","timeScope:\n" + + " variable: date\n" + + " component: days"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeVariableComponentKeyUnknownComponent", onlyError.getMessage()); + } + + @Test + public void testTimeScopeVariableComponentWrongChecker() { + ConfigurationParsingResult configurationParsingResult = parseYaml("checker:\n" + + " name: Date", "checker:\n" + + " name: Dates"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeScopeVariableComponentWrongChecker", onlyError.getMessage()); + } + + @Test + public void testTimeScopeVariableComponentPatternUnknown() { + ConfigurationParsingResult configurationParsingResult = parseYaml("params:\n" + + " pattern: dd/MM/yyyy","params:\n" + + " pattern: dd/MM"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("timeScopeVariableComponentPatternUnknown", onlyError.getMessage()); + } + + @Test + public void testUnrecognizedProperty() { + ConfigurationParsingResult configurationParsingResult = parseYaml("compositeReferences","compositReference"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("unrecognizedProperty", onlyError.getMessage()); + } + + @Test + public void testInvalidFormat() { + ConfigurationParsingResult configurationParsingResult = parseYaml("firstRowLine: 2", "firstRowLine: pas_un_chiffre"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("invalidFormat", onlyError.getMessage()); + } + + @Test + public void testMissingRequiredExpression() { + ConfigurationParsingResult configurationParsingResult = parseYaml("\"true\"", ""); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("missingRequiredExpression", onlyError.getMessage()); + } + + @Test + public void testIllegalGroovyExpression() { + ConfigurationParsingResult configurationParsingResult = parseYaml("\"true\"", "if(}"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("illegalGroovyExpression", onlyError.getMessage()); + } + + @Test + public void testUnknownCheckerName() { + ConfigurationParsingResult configurationParsingResult = parseYaml("name: GroovyExpression", "name: GroovyExpressions"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("unknownCheckerName", onlyError.getMessage()); + } + + @Test + public void testCsvBoundToUnknownVariable() { + ConfigurationParsingResult configurationParsingResult = parseYaml("header: \"typeSite\"\n" + + " boundTo:\n" + + " variable: localization", "header: \"typeSite\"\n" + + " boundTo:\n" + + " variable: localizations"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("csvBoundToUnknownVariable", onlyError.getMessage()); + } + + @Test + public void testCsvBoundToUnknownVariableComponent() { + ConfigurationParsingResult configurationParsingResult = parseYaml("components:\n" + + " site:", "components:\n" + + " sites:"); + Assert.assertFalse(configurationParsingResult.isValid()); + ValidationCheckResult onlyError = Iterables.getOnlyElement(configurationParsingResult.getValidationCheckResults()); + log.debug(onlyError.getMessage()); + Assert.assertEquals("csvBoundToUnknownVariableComponent", onlyError.getMessage()); + } } \ No newline at end of file diff --git a/src/test/java/fr/inra/oresing/rest/Fixtures.java b/src/test/java/fr/inra/oresing/rest/Fixtures.java index 3eb3376d0bfe5172eb762d71506e472f8536450e..7d47f16b8c14438d12f26864a589cd943c8eea91 100644 --- a/src/test/java/fr/inra/oresing/rest/Fixtures.java +++ b/src/test/java/fr/inra/oresing/rest/Fixtures.java @@ -261,6 +261,10 @@ public class Fixtures { } } + public String getValidationApplicationConfigurationResourceName() { + return "/data/validation/fake-app.yaml"; + } + public String getHauteFrequenceApplicationConfigurationResourceName() { return "/data/hautefrequence/hautefrequence.yaml"; } diff --git a/src/test/resources/data/validation/fake-app.yaml b/src/test/resources/data/validation/fake-app.yaml new file mode 100644 index 0000000000000000000000000000000000000000..985e1f8c7deb5420a44036d51ff6f922558ca90d --- /dev/null +++ b/src/test/resources/data/validation/fake-app.yaml @@ -0,0 +1,142 @@ +version: 0 +application: + name: Sites + version: 1 +compositeReferences: + localizations: + components: + - reference: typeSites + - parentKeyColumn: "nom du type de site" + reference: sites + - parentKeyColumn: "nom du site" + reference: plateformes +references: + projets: + separator: + keyColumns: [nom du projet_key] + columns: + nom du projet_key: + nom du projet_fr: + nom du projet_en: + description du projet_fr: + description du projet_en: + plateformes: + separator: + keyColumns: [nom de la plateforme_key] + columns: + nom de la plateforme_key: + nom du site: + nom de la plateforme_fr: + nom de la plateforme_en: + latitude: + longitude: + altitude: + nom du type de plateforme: + code sandre: + code sandre du contexte: + typeSites: + separator: + keyColumns: [nom_key] + columns: + nom_key: + nom_fr: + nom_en: + description_fr: + description_en: + sites: + separator: + keyColumns: [nom du site_key] + columns: + nom du type de site: + nom du site_key: + nom du site_fr: + nom du site_en: + description du site_fr: + description du site_en: + code sandre du Plan d'eau: + code sandre de la Masse d'eau plan d'eau: +dataTypes: + site: + authorization: + dataGroups: + referentiel: + label: "Référentiel" + data: + - localization + - date + qualitatif: + label: "Données qualitatives" + data: + - Couleur des individus + localizationScope: + variable: localization + component: site + timeScope: + variable: date + component: day + data: + date: + components: + day: + checker: + name: Date + params: + pattern: dd/MM/yyyy + time: + checker: + name: Date + params: + pattern: hh:mm:ss + localization: + components: + site: + checker: + name: Reference + params: + refType: sites + typeSite: + checker: + name: Reference + params: + refType: typeSites + Couleur des individus: + components: + value: + validations: + exempldeDeRegleDeValidation: + description: "Juste un exemple" + checker: + name: GroovyExpression + params: + expression: "true" + format: + constants: + - rowNumber: 1 + columnNumber: 2 + boundTo: + variable: localization + component: site + exportHeader: "Site" + headerLine: 1 + firstRowLine: 2 + columns: + - header: "typeSite" + boundTo: + variable: localization + component: typeSite + - header: "site" + boundTo: + variable: localization + component: site + - header: "date" + boundTo: + variable: date + component: day + - header: "heure" + boundTo: + variable: date + component: time + - header: "Couleur des individus" + boundTo: + variable: Couleur des individus + component: value \ No newline at end of file diff --git a/ui2/src/locales/fr.json b/ui2/src/locales/fr.json index 1cc85cb593afb8e0550e25b3641bbb4f10c94e64..481368c644081f2b5a9f2bb540a08505bbbff6dc 100644 --- a/ui2/src/locales/fr.json +++ b/ui2/src/locales/fr.json @@ -47,24 +47,25 @@ }, "errors": { "emptyFile": "Le fichier est vide", - "missingReference": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, il faut préciser le référentiel parmi <code>{references}</code>", - "unsupportedVersion": "Les fichiers YAML de version <code>{actualVersion}</code> ne sont pas gérés, version attendue : <code>{expectedVersion}</code>", - "undeclaredDataGroup": "La variable <code>{variable}</code> n’est déclarée appartenir à aucun groupe de données, elle doit être présente dans un groupe", - "variableInMultipleData": "La variable <code>{variable}</code> est déclarée dans plusieurs groupes de données, elle ne doit être présente que dans un groupe", - "unknownVariablesDataGroup": "le groupe de données <code>{dataGroup}</code> contient des données qui ne sont pas déclarées <code>{unknownVariables}</code>. <br>Données connues <code>{variables}</code>", - "missingTimeScope": "Il faut indiquer la variable (et son composant) dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", - "timeScopeVariableComponentKeyMissingVariable": "Il faut indiquer la variable dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. <br>Valeurs possibles <code>{variables}</code>", + "missingReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, il faut préciser le référentiel parmi <code>{references}</code>", + "unknownReferenceForChecker": "Pour le type de données <code>{dataType}</code>, la donnée <code>{datum}</code>, le composant <code>{component}</code>, la référence <code>{refType}</code> n’est pas dans les références acceptés qui sont : <code>{references}</code>", + "unsupportedVersion": "Les fichiers YAML de version <code>{actualVersion}</code> ne sont pas gérés, version attendue <code>{expectedVersion}</code>", + "undeclaredDataGroupForVariable": "La variable <code>{variable}</code> n’est déclarée appartenir à aucun groupe de données, elle doit être présente dans un groupe", + "variableInMultipleDataGroup": "La variable <code>{variable}</code> est déclarée dans plusieurs groupes de données, elle ne doit être présente que dans un groupe", + "unknownVariablesInDataGroup": "le groupe de données <code>{dataGroup}</code> contient des données qui ne sont pas déclarées <code>{unknownVariables}</code>. Données connues <code>{variables}</code>", + "missingTimeScopeVariableComponentKey": "Il faut indiquer la variable (et son composant) dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>", + "timeScopeVariableComponentKeyMissingVariable": "Il faut indiquer la variable dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{variables}</code>", "timeScopeVariableComponentKeyUnknownVariable": "<code>{variable}</code> ne fait pas parti des colonnes connues <code>{knownVariables}</code>", - "timeVariableComponentKeyMissingComponent": "Il faut indiquer le composant de la variable <code>{variable}</code> dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. <br>Valeurs possibles <code>{knownComponents}</code>", - "timeVariableComponentKeyUnknownComponent": "<code>{component}</code> ne fait pas parti des composants connus pour la variable <code>{variable}</code>. Composants connus : <code>{knownComponents}</code>", + "timeVariableComponentKeyMissingComponent": "Il faut indiquer le composant de la variable <code>{variable}</code> dans laquelle on recueille la période de temps à laquelle rattacher la donnée pour le gestion des droits jeu de données <code>{dataType}</code>. Valeurs possibles <code>{knownComponents}</code>", + "timeVariableComponentKeyUnknownComponent": "<code>{component}</code> ne fait pas parti des composants connus pour la variable <code>{variable}</code>. Composants connus : <code>{knownComponents}</code>", "timeScopeVariableComponentWrongChecker": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car ce n’est pas une donnée déclarée comme <code>{expectedChecker}</code>", - "timeScopeVariableComponentPatternUnknown": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car le format de date <code>{pattern}</code> n’est pas géré. <br>Formats acceptés : <code>{knownPatterns}</code>", - "unrecognizedProperty": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, c'est pas une propriété reconnue. Les propriétés reconnues sont <code>{knownProperties}</code>", - "invalidFormat": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : <code>{value}</code> n’a pas le bon format. Le type attendu est <code>{targetTypeName}</code>", - "missingRequiredExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, vous devez renseigner l'expression à évaluer pour contrôler que la règle est respectée par les données", - "illegalGroovyExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, l'expression renseignée <code>{expression}</code> n'est pas correcte. <br>Erreur de compilation de l'expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", + "timeScopeVariableComponentPatternUnknown": "Le composant <code>{component}</code> de la variable <code>{variable}</code> ne peut pas être utilisé comme portant l’information temporelle car le format de date '<code>{pattern}</code>' n’est pas géré. Formats acceptés : <code>{knownPatterns}</code>", + "unrecognizedProperty": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : <code>{unknownPropertyName}</code>, c’est pas une propriété reconnue. Les propriétés reconnues sont <code>{knownProperties}</code>", + "invalidFormat": "Erreur à la ligne <code>{lineNumber}</code> (colonne <code>{columnNumber}</code>) : '<code>{value}</code>' n’a pas le bon format. Le type attendu est <code>{targetTypeName}</code>", + "missingRequiredExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, vous devez renseigner l’expression à évaluer pour contrôler que la règle est respectée par les données", + "illegalGroovyExpression": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, l’expression renseignée <code>{expression}</code> n’est pas correcte. Erreur de compilation de l’expression à la ligne <code>{compilationError.lineNumber}</code> (colonne <code>{compilationError.columnNumber}</code>) message '<code>{compilationError.message}</code>'", "unknownCheckerName": "Pour la règle de validation <code>{lineValidationRuleKey}</code>, '<code>{checkerName}</code>' est déclaré mais ce n’est pas un contrôle connu", - "csvBoundToUnknownVariable": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> qui n'est pas connue. Variables connues <code>{variables}</code>", - "csvBoundToUnknownVariableComponent": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> mais elle n'a pas de composant <code>{component}</code>. <br>Composants connus <code>{components}</code>" + "csvBoundToUnknownVariable": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> qui n’est pas connue. Variables connues <code>{variables}</code>", + "csvBoundToUnknownVariableComponent": "Dans le format CSV, l’entête <code>{header}</code> est lié à la variable <code>{variable}</code> mais elle n’a pas de composant <code>{component}</code>. Composants connus <code>{components}</code>" } } diff --git a/ui2/src/services/ErrorsService.js b/ui2/src/services/ErrorsService.js index efb14be5771631ff2b274c8e0ff919378fab14f7..d27065c8ee6c3fd458c7966790dda20eaa0faf3a 100644 --- a/ui2/src/services/ErrorsService.js +++ b/ui2/src/services/ErrorsService.js @@ -3,12 +3,13 @@ import { i18n } from "@/main"; const ERRORS = { emptyFile: () => i18n.t("errors.emptyFile"), - missingReferenceForChecker: (params) => i18n.t("errors.missingReference", params), + missingReferenceForChecker: (params) => i18n.t("errors.missingReferenceForChecker", params), + unknownReferenceForChecker: (params) => i18n.t("errors.unknownReferenceForChecker", params), unsupportedVersion: (params) => i18n.t("errors.unsupportedVersion", params), - undeclaredDataGroupForVariable: (params) => i18n.t("errors.undeclaredDataGroup", params), + undeclaredDataGroupForVariable: (params) => i18n.t("errors.undeclaredDataGroupForVariable", params), variableInMultipleDataGroup: (params) => i18n.t("errors.variableInMultipleData", params), - unknownVariablesInDataGroup: (params) => i18n.t("errors.unknownVariablesDataGroup", params), - missingTimeScopeVariableComponentKey: (params) => i18n.t("errors.missingTimeScope", params), + unknownVariablesInDataGroup: (params) => i18n.t("errors.unknownVariablesInDataGroup", params), + missingTimeScopeVariableComponentKey: (params) => i18n.t("errors.missingTimeScopeVariableComponentKey", params), timeScopeVariableComponentKeyMissingVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyMissingVariable", params), timeScopeVariableComponentKeyUnknownVariable: (params) => i18n.t("errors.timeScopeVariableComponentKeyUnknownVariable", params), timeVariableComponentKeyMissingComponent: (params) => i18n.t("errors.timeVariableComponentKeyMissingComponent", params),