예제 #1
0
 /**
  * @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());
         }
     }
 }
예제 #2
0
 protected function introduceIntrospectionFields()
 {
     $schemaField = new SchemaField();
     $this->schema->addQueryField($schemaField);
     $this->schema->addQueryField(new TypeDefinitionField());
 }
예제 #3
0
 /**
  * @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);
 }