/**
  * Generate a schema for the given configuration or YAML file.
  *
  * ./flow configuration:generateschema --type Settings --path TYPO3.Flow.persistence
  *
  * The schema will be output to standard output.
  *
  * @param string $type Configuration type to create a schema for
  * @param string $path path to the subconfiguration separated by "." like "TYPO3.Flow"
  * @param string $yaml YAML file to create a schema for
  * @return void
  */
 public function generateSchemaCommand($type = null, $path = null, $yaml = null)
 {
     $data = null;
     if ($yaml !== null && is_file($yaml) && is_readable($yaml)) {
         $data = Yaml::parse($yaml);
     } elseif ($type !== null) {
         $data = $this->configurationManager->getConfiguration($type);
         if ($path !== null) {
             $data = Arrays::getValueByPath($data, $path);
         }
     }
     if (empty($data)) {
         $this->outputLine('Data was not found or is empty');
         $this->quit(1);
     }
     $this->outputLine(Yaml::dump($this->schemaGenerator->generate($data), 99));
 }
 /**
  * Generate a schema for the given configuration or YAML file.
  *
  * ./flow configuration:generateschema --type Settings --path TYPO3.Flow.persistence
  *
  * The schema will be output to standard output.
  *
  * @param string $type Configuration type to create a schema for
  * @param string $path path to the subconfiguration separated by "." like "TYPO3.Flow"
  * @param string $yaml YAML file to create a schema for
  * @return void
  */
 public function generateSchemaCommand($type = NULL, $path = NULL, $yaml = NULL)
 {
     $data = NULL;
     if ($yaml !== NULL && is_file($yaml) && is_readable($yaml)) {
         $data = \Symfony\Component\Yaml\Yaml::parse($yaml);
     } elseif ($type !== NULL) {
         $data = $this->configurationManager->getConfiguration($type);
         if ($path !== NULL) {
             $data = \TYPO3\Flow\Utility\Arrays::getValueByPath($data, $path);
         }
     }
     if (empty($data)) {
         $this->outputLine('Data was not found or is empty');
         return;
     }
     $yaml = \Symfony\Component\Yaml\Yaml::dump($this->schemaGenerator->generate($data), 99);
     $this->output($yaml . chr(10));
 }
 /**
  * @dataProvider schemaGenerationForArrayOfTypesDataProvider
  * @test
  */
 public function testSchemaGenerationForArrayOfTypes($value, $expectedSchema)
 {
     $schema = $this->configurationGenerator->generate($value);
     $this->assertEquals($schema, $expectedSchema);
 }