diff --git a/core/src/main/java/gov/nist/secauto/metaschema/core/model/AbstractGlobalDefinition.java b/core/src/main/java/gov/nist/secauto/metaschema/core/model/AbstractGlobalDefinition.java index bb8100c24..f89623f0d 100644 --- a/core/src/main/java/gov/nist/secauto/metaschema/core/model/AbstractGlobalDefinition.java +++ b/core/src/main/java/gov/nist/secauto/metaschema/core/model/AbstractGlobalDefinition.java @@ -60,12 +60,6 @@ public final QName getDefinitionQName() { return definitionQName.get(); } - @Override - public final boolean isInline() { - // never inline - return false; - } - @Override public final INSTANCE getInlineInstance() { // never inline diff --git a/databind/src/main/java/gov/nist/secauto/metaschema/databind/RootAssemblyBindingMatcher.java b/databind/src/main/java/gov/nist/secauto/metaschema/databind/RootAssemblyBindingMatcher.java index 40ab248f2..838da028c 100644 --- a/databind/src/main/java/gov/nist/secauto/metaschema/databind/RootAssemblyBindingMatcher.java +++ b/databind/src/main/java/gov/nist/secauto/metaschema/databind/RootAssemblyBindingMatcher.java @@ -51,4 +51,9 @@ public Class getBoundClassForXmlQName(QName rootQName) { public Class getBoundClassForJsonName(String rootName) { return getRootJsonName().equals(rootName) ? getClazz() : null; } + + @Override + public String toString() { + return getDefinition().getRootXmlQName().toString(); + } } diff --git a/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/IBoundDefinitionModelComplex.java b/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/IBoundDefinitionModelComplex.java index 59036b177..3ae7306d0 100644 --- a/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/IBoundDefinitionModelComplex.java +++ b/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/IBoundDefinitionModelComplex.java @@ -26,11 +26,6 @@ public interface IBoundDefinitionModelComplex @NonNull Map> getJsonProperties(@Nullable Predicate flagFilter); - @Override - default boolean isInline() { - return getBoundClass().getEnclosingClass() != null; - } - @Nullable Method getBeforeDeserializeMethod(); diff --git a/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/impl/AbstractBoundDefinitionModelComplex.java b/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/impl/AbstractBoundDefinitionModelComplex.java index b05c8e1ca..e175ef956 100644 --- a/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/impl/AbstractBoundDefinitionModelComplex.java +++ b/databind/src/main/java/gov/nist/secauto/metaschema/databind/model/impl/AbstractBoundDefinitionModelComplex.java @@ -96,11 +96,6 @@ public final QName getDefinitionQName() { return definitionQName.get(); } - @Override - public boolean isInline() { - return getBoundClass().getEnclosingClass() != null; - } - @Override public Method getBeforeDeserializeMethod() { return beforeDeserializeMethod; diff --git a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java index 3829bd66e..c0781d935 100644 --- a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java +++ b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/AbstractValidateContentCommand.java @@ -290,8 +290,8 @@ public ExitStatus execute() { IValidationResult validationResult = null; try { + IModule module = getModule(getCommandLine(), bindingContext); if (!cmdLine.hasOption(NO_SCHEMA_VALIDATION_OPTION)) { - IModule module = getModule(getCommandLine(), bindingContext); // perform schema validation validationResult = getSchemaValidationProvider(module, getCommandLine(), bindingContext) .validateWithSchema(source, asFormat, bindingContext); diff --git a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/ValidateContentUsingModuleCommand.java b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/ValidateContentUsingModuleCommand.java index 7e2eda757..fcc0bcae1 100644 --- a/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/ValidateContentUsingModuleCommand.java +++ b/metaschema-cli/src/main/java/gov/nist/secauto/metaschema/cli/commands/ValidateContentUsingModuleCommand.java @@ -105,6 +105,7 @@ protected IModule getModule( MetaschemaCommands.METASCHEMA_REQUIRED_OPTION, cwd, bindingContext); + module = bindingContext.registerModule(module); } catch (URISyntaxException ex) { throw new IOException(String.format("Cannot load module as '%s' is not a valid file or URL.", ex.getInput()), ex); diff --git a/metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java b/metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java index 6675d7602..fca8d68c3 100644 --- a/metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java +++ b/metaschema-cli/src/test/java/gov/nist/secauto/metaschema/cli/CLITest.java @@ -12,6 +12,7 @@ import gov.nist.secauto.metaschema.cli.processor.ExitCode; import gov.nist.secauto.metaschema.cli.processor.ExitStatus; +import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -44,7 +45,8 @@ void evaluateResult(@NonNull ExitStatus status, @NonNull ExitCode expectedCode, } private static Stream providesValues() { - @SuppressWarnings("serial") List values = new LinkedList<>() { + @SuppressWarnings("serial") + List values = new LinkedList<>() { { add(Arguments.of(new String[] {}, ExitCode.INVALID_COMMAND, NO_EXCEPTION_CLASS)); @@ -188,7 +190,7 @@ private static Stream providesValues() { "--show-stack-trace" }, ExitCode.FAIL, NO_EXCEPTION_CLASS)); - ; + } }; return values.stream(); @@ -207,4 +209,16 @@ void testAllCommands(@NonNull String[] args, @NonNull ExitCode expectedExitCode, evaluateResult(CLI.runCli(fullArgs), expectedExitCode, expectedThrownClass); } } + + @Test + void test() { + String[] cliArgs = { "validate-content", + "-m", + "src/test/resources/content/215-module.xml", + "src/test/resources/content/215.xml", + "--disable-schema-validation", + "--show-stack-trace" + }; + CLI.runCli(cliArgs); + } }