graphql-paper
Version:
A flexible in-memory store based on a GraphQL Schema
22 lines (21 loc) • 572 B
JavaScript
import { isObjectType } from 'graphql';
import { FieldReturnTypeMismatch } from '../errors/field-return-type-mismatch.mjs';
var objectFieldValidator = {
skipConnectionValue: true,
skipNullValue: true,
validate(_ref) {
var {
field,
fieldValue
} = _ref;
if (isObjectType(field.type) && typeof fieldValue !== 'object') {
throw new FieldReturnTypeMismatch({
field: field,
expected: 'object',
actual: typeof fieldValue
});
}
}
};
export { objectFieldValidator };
//# sourceMappingURL=object-field.mjs.map