/** * @param AbstractSchema $schema * * @throws ConfigurationException */ public function validate(AbstractSchema $schema) { if (!$schema->getQueryType()->hasFields()) { throw new ConfigurationException('Schema has to have fields'); } $this->configValidator = ConfigValidator::getInstance(); foreach ($schema->getQueryType()->getConfig()->getFields() as $field) { $this->configValidator->assertValidConfig($field->getConfig()); if ($field->getType() instanceof AbstractObjectType) { $this->assertInterfaceImplementationCorrect($field->getType()); } } }
protected function introduceIntrospectionFields() { $schemaField = new SchemaField(); $this->schema->addQueryField($schemaField); $this->schema->addQueryField(new TypeDefinitionField()); }
/** * @param AbstractSchema|Field $value * * @return string|null * * //todo implement value printer */ public function resolveDefaultValue($value) { $resolvedValue = $value->getConfig()->getDefaultValue(); return $resolvedValue === null ? $resolvedValue : json_encode($resolvedValue); }