Esempio n. 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());
         }
     }
 }
Esempio n. 2
0
 protected function introduceIntrospectionFields()
 {
     $schemaField = new SchemaField();
     $this->schema->addQueryField($schemaField);
     $this->schema->addQueryField(new TypeDefinitionField());
 }
Esempio n. 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);
 }