Skip to content

Commit

Permalink
Merge pull request 'release_1.1.5' (#9) from release_1.1.5 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominick Leppich committed Oct 24, 2024
2 parents 992ad5d + d21701e commit 494e9d9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 37 deletions.
2 changes: 0 additions & 2 deletions migration/lib/data/field_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ def post_process(self, fallback_language):
logging.warning(f'Fallback language {fallback_language} is not defined for field definition:\n{self.__str__()}')
fallback_translations[0]['fallback'] = True
fallback_translations[0]['required'] = True
if self['titleField']:
self['required'] = True
if self['mainEntry']:
self['required'] = True

Expand Down
4 changes: 2 additions & 2 deletions module-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>io.goobi.vocabulary</groupId>
<artifactId>vocabulary-server-core</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<name>Vocabulary-Server-Core</name>
<description>Spring Boot based RESTful web service for vocabulary management</description>
<packaging>jar</packaging>
Expand All @@ -26,7 +26,7 @@
<dependency>
<groupId>io.goobi.vocabulary</groupId>
<artifactId>vocabulary-server-exchange</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<scope>compile</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public SchemaValidatorImpl(Validator<FieldDefinitionEntity> fieldDefinitionValid
this::checkFieldDefinitionExistence,
this::checkSingleMainFieldDefinition,
this::checkMainFieldIsRequired,
this::checkTitleFieldsAreRequired,
this::perFieldDefinitionChecks
));
}
Expand Down Expand Up @@ -70,20 +69,6 @@ private void checkMainFieldIsRequired(VocabularySchemaEntity schema) throws Voca
}
}

private void checkTitleFieldsAreRequired(VocabularySchemaEntity schema) throws VocabularyException {
List<String> titleFieldsThatAreNotRequired = schema.getDefinitions().stream()
.filter(d -> Boolean.TRUE.equals(d.isTitleField()))
.filter(d -> Boolean.FALSE.equals(d.isRequired()))
.map(FieldDefinitionEntity::getName)
.collect(Collectors.toList());
if (!titleFieldsThatAreNotRequired.isEmpty()) {
throw new VocabularyException(SchemaValidationTitleFieldsAreNotRequired, null, Map.of(
"titleFieldNames", String.join(",", titleFieldsThatAreNotRequired)
),
params -> "Title fields need to be required: " + params.get("titleFieldNames"));
}
}

private void perFieldDefinitionChecks(VocabularySchemaEntity schema) throws VocabularyException {
List<VocabularyException> errors = new LinkedList<>();
for (FieldDefinitionEntity d : schema.getDefinitions()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,6 @@ void exactlyOneMainFieldDefinitionThatIsNotRequired_fails() {
assertThrows(VocabularyException.class, () -> validator.validate(schema));
}

@Test
void titleFieldsThatIsNotRequired_fails() {
VocabularySchemaEntity schema = new VocabularySchemaEntity();

FieldDefinitionEntity mainEntryField = validMainField(schema, "Main");
FieldDefinitionEntity titleField = new FieldDefinitionEntity();
titleField.setSchema(schema);
titleField.setName("Title");
titleField.setTitleField(true);
titleField.setRequired(false);

schema.setDefinitions(List.of(mainEntryField, titleField));

assertThrows(VocabularyException.class, () -> validator.validate(schema));
}

@Test
void titleFieldsThatIsRequired_success() throws VocabularyException {
VocabularySchemaEntity schema = new VocabularySchemaEntity();
Expand Down
2 changes: 1 addition & 1 deletion module-exchange/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.goobi.vocabulary</groupId>
<artifactId>vocabulary-server-exchange</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<name>Vocabulary Exchange</name>
<description>Vocabulary data exchange classes</description>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.goobi.vocabulary</groupId>
<artifactId>vocabulary-server</artifactId>
<version>1.1.4</version>
<version>1.1.5</version>
<name>Vocabulary-Server</name>
<packaging>pom</packaging>
<description>RESTful webservice for vocabulary management</description>
Expand Down

0 comments on commit 494e9d9

Please sign in to comment.