if (testQEMUSchemaValidateCommand(cmdname, args, test->qapischema,
test->skipValidationDeprecated,
test->skipValidationRemoved,
+ false,
&debug) < 0) {
if (virTestGetDebug() == 2) {
g_autofree char *argstr = NULL;
return -1;
if (testQEMUSchemaValidateCommand(command->schema, jsonargs,
- schema, false, false, &debug) < 0) {
+ schema, false, false, false, &debug) < 0) {
VIR_TEST_VERBOSE("failed to validate '%s %s' against QAPI schema: %s",
command->name, curargs, virBufferCurrentContent(&debug));
return -1;
GHashTable *schema;
virBuffer *debug;
bool allowDeprecated;
+ bool allowIncomplete; /* allow members not (yet) covered by the schema */
};
/* lookup 'member' entry for key */
if (!(keymember = testQEMUSchemaStealObjectMemberByName(key, data->rootmembers))) {
+ if (data->ctxt->allowIncomplete) {
+ virBufferAddLit(data->ctxt->debug, " schema missing - OK(waived)\n");
+ return 0;
+ }
virBufferAddLit(data->ctxt->debug, "ERROR: attribute not in schema\n");
return -1;
}
* @allowDeprecated: don't fails schema validation if @command or one of @arguments
* is deprecated
* @allowRemoved: skip validation fully if @command was not found
+ * @allowIncomplete: don't fail validation if members not covered by schema are present
+ * (for waiving commands with incomplete schema)
* @debug: a virBuffer which will be filled with debug information if provided
*
* Validates whether @command and its @arguments conform to the QAPI schema
GHashTable *schema,
bool allowDeprecated,
bool allowRemoved,
+ bool allowIncomplete,
virBuffer *debug)
{
struct testQEMUSchemaValidateCtxt ctxt = { .schema = schema,
.debug = debug,
- .allowDeprecated = allowDeprecated };
+ .allowDeprecated = allowDeprecated,
+ .allowIncomplete = allowIncomplete };
g_autofree char *schemapatharguments = g_strdup_printf("%s/arg-type", command);
g_autoptr(virJSONValue) emptyargs = NULL;
virJSONValue *schemarootcommand;