/** * 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); }
/** * 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); }