(context, type)
| 6684 | } |
| 6685 | } |
| 6686 | function validateFields(context, type) { |
| 6687 | const fields = Object.values(type.getFields()); |
| 6688 | if (fields.length === 0) { |
| 6689 | context.reportError(`Type ${type.name} must define one or more fields.`, [ |
| 6690 | type.astNode, |
| 6691 | ...type.extensionASTNodes |
| 6692 | ]); |
| 6693 | } |
| 6694 | for (const field of fields) { |
| 6695 | validateName(context, field); |
| 6696 | if (!(0, _definition.isOutputType)(field.type)) { |
| 6697 | var _field$astNode; |
| 6698 | context.reportError( |
| 6699 | `The type of ${type.name}.${field.name} must be Output Type but got: ${(0, _inspect.inspect)(field.type)}.`, |
| 6700 | (_field$astNode = field.astNode) === null || _field$astNode === void 0 ? void 0 : _field$astNode.type |
| 6701 | ); |
| 6702 | } |
| 6703 | for (const arg of field.args) { |
| 6704 | const argName = arg.name; |
| 6705 | validateName(context, arg); |
| 6706 | if (!(0, _definition.isInputType)(arg.type)) { |
| 6707 | var _arg$astNode2; |
| 6708 | context.reportError( |
| 6709 | `The type of ${type.name}.${field.name}(${argName}:) must be Input Type but got: ${(0, _inspect.inspect)(arg.type)}.`, |
| 6710 | (_arg$astNode2 = arg.astNode) === null || _arg$astNode2 === void 0 ? void 0 : _arg$astNode2.type |
| 6711 | ); |
| 6712 | } |
| 6713 | if ((0, _definition.isRequiredArgument)(arg) && arg.deprecationReason != null) { |
| 6714 | var _arg$astNode3; |
| 6715 | context.reportError( |
| 6716 | `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, |
| 6717 | [ |
| 6718 | getDeprecatedDirectiveNode(arg.astNode), |
| 6719 | (_arg$astNode3 = arg.astNode) === null || _arg$astNode3 === void 0 ? void 0 : _arg$astNode3.type |
| 6720 | ] |
| 6721 | ); |
| 6722 | } |
| 6723 | } |
| 6724 | } |
| 6725 | } |
| 6726 | function validateInterfaces(context, type) { |
| 6727 | const ifaceTypeNames = /* @__PURE__ */ Object.create(null); |
| 6728 | for (const iface of type.getInterfaces()) { |
no test coverage detected