Skip to content

#162 Change warning to error in metadata validation #163

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

Merged
merged 3 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ dependencies {
//TODO: choose one schema validator between this and rest-assured
implementation 'com.networknt:json-schema-validator:1.0.70'
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'org.apache.commons:commons-text:1.9'
implementation 'org.apache.commons:commons-text:1.10.0'

}

Expand Down Expand Up @@ -156,7 +156,7 @@ tasks.register('testDataDictionary_1_7') {
dependsOn jar, prepareCertificationEnvironment
doLast {
javaexec {
main = 'io.cucumber.core.cli.Main'
mainClass = 'io.cucumber.core.cli.Main'
classpath = configurations.cucumberRuntime + sourceSets.main.output + sourceSets.test.output
systemProperties = System.getProperties()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.apache.olingo.commons.api.edm.EdmElement;
import org.apache.olingo.commons.api.edm.EdmProperty;
import org.reso.commander.common.ODataUtils;
import static org.reso.commander.common.TestUtils.failAndExitWithErrorMessage;

import java.lang.reflect.Type;
import java.util.List;
Expand Down Expand Up @@ -117,13 +118,14 @@ public JsonElement serialize(FieldJson src, Type typeOfSrc, JsonSerializationCon
field.addProperty(RESOURCE_NAME_KEY, src.resourceName);
field.addProperty(FIELD_NAME_KEY, src.edmElement.getName());

String typeName = null;
String typeName;
try {
typeName = src.edmElement.getType().getFullQualifiedName().getFullQualifiedNameAsString();
field.addProperty(TYPE_KEY, typeName);
} catch (Exception ex) {
//Issue #162: Need to fail on serialization exceptions since Olingo metadata validation might not catch them
LOG.error(getDefaultErrorMessage("Field Name:", src.edmElement.getName(), ex.toString()));
field.addProperty(TYPE_KEY, "UNDEFINED");
failAndExitWithErrorMessage(ex.toString(), LOG);
}

field.addProperty(NULLABLE_KEY, ((EdmProperty) src.edmElement).isNullable());
Expand Down