Inheritance: implements Joli\Jane\Guesser\TypeGuesserInterface, implements Joli\Jane\Guesser\PropertiesGuesserInterface, implements Joli\Jane\Guesser\ClassGuesserInterface
 /**
  * Return a list of class guessed
  *
  * @param string $openApiSpec
  * @param string $name
  * @param string $namespace
  * @param string $directory
  *
  * @return Context
  */
 public function createContext($openApiSpec, $name, $namespace, $directory)
 {
     $schema = $this->serializer->deserialize(file_get_contents($openApiSpec), 'Joli\\Jane\\OpenApi\\Model\\OpenApi', 'json');
     $classes = $this->chainGuesser->guessClass($schema, $name);
     foreach ($classes as $class) {
         $properties = $this->chainGuesser->guessProperties($class->getObject(), $name, $classes);
         foreach ($properties as $property) {
             $property->setType($this->chainGuesser->guessType($property->getObject(), $property->getName(), $classes));
         }
         $class->setProperties($properties);
     }
     return new Context($schema, $namespace, $directory, $classes);
 }
Beispiel #2
0
 /**
  * Return a list of class guessed
  *
  * @param string $openApiSpec
  * @param string $name
  * @param string $namespace
  * @param string $directory
  *
  * @return Context
  */
 public function createContext($openApiSpec, $name, $namespace, $directory)
 {
     $schema = $this->schemaParser->parseSchema($openApiSpec);
     $classes = $this->chainGuesser->guessClass($schema, $name);
     foreach ($classes as $class) {
         $properties = $this->chainGuesser->guessProperties($class->getObject(), $name, $classes);
         foreach ($properties as $property) {
             $property->setType($this->chainGuesser->guessType($property->getObject(), $property->getName(), $classes));
         }
         $class->setProperties($properties);
     }
     return new Context($schema, $namespace, $directory, $classes);
 }
Beispiel #3
0
 public static function create(SerializerInterface $serializer)
 {
     $chainGuesser = new ChainGuesser();
     $chainGuesser->addGuesser(new ReferenceGuesser(new Resolver($serializer)));
     return $chainGuesser;
 }
 public static function create(SerializerInterface $serializer, array $options = [])
 {
     $naming = new Naming();
     $resolver = new Resolver($serializer);
     $dateFormat = isset($options['date-format']) ? $options['date-format'] : \DateTime::RFC3339;
     $chainGuesser = new ChainGuesser();
     $chainGuesser->addGuesser(new DateTimeGuesser($dateFormat));
     $chainGuesser->addGuesser(new ReferenceGuesser($resolver));
     $chainGuesser->addGuesser(new OpenApiGuesser());
     $chainGuesser->addGuesser(new SchemaGuesser($naming, $resolver));
     $chainGuesser->addGuesser(new AdditionalPropertiesGuesser());
     $chainGuesser->addGuesser(new AllOfGuesser($resolver));
     $chainGuesser->addGuesser(new ArrayGuesser());
     $chainGuesser->addGuesser(new ItemsGuesser());
     $chainGuesser->addGuesser(new SimpleTypeGuesser());
     $chainGuesser->addGuesser(new MultipleGuesser());
     return $chainGuesser;
 }
 public static function create(SerializerInterface $serializer)
 {
     $naming = new Naming();
     $resolver = new Resolver($serializer);
     $chainGuesser = new ChainGuesser();
     $chainGuesser->addGuesser(new ReferenceGuesser($resolver));
     $chainGuesser->addGuesser(new OpenApiGuesser());
     $chainGuesser->addGuesser(new SchemaGuesser($naming, $resolver));
     $chainGuesser->addGuesser(new AdditionalPropertiesGuesser());
     $chainGuesser->addGuesser(new AllOfGuesser($resolver));
     $chainGuesser->addGuesser(new ArrayGuesser());
     $chainGuesser->addGuesser(new ItemsGuesser());
     $chainGuesser->addGuesser(new SimpleTypeGuesser());
     $chainGuesser->addGuesser(new MultipleGuesser());
     return $chainGuesser;
 }