pub.schema:validate using document type

I’m trying to validate a document using pub.schema:validate. Here is a representative doc type definition (named ABC):

ID (string - required, no null)
Name (string - optional)
Summary (document list - required, no null)
…Product (string - required, no null)
…Type (string - required, no null)
Stage (string - required, no null)

Document var xyz has these fields present:

ID - 123
Name - foo
Stage - bar

Calling pub.schema:validate with these inputs:

object - xyz
conformsTo - ABC (IS doc type, not a schema)
maxErrors - -1
failIfInvalid - true

I expect the call to fail since xyz does not have the required doc list “Summary” present, but it does not. It fails as expected if “Stage” is omitted.

I’m missing something simple, I’m sure. Does anyone have an idea of what I’m overlooking?

I think you must inspect the conformsTo value you are setting, this value affects the result:

Hope this give you a hint :smiley: