public function denormalize($data, $class, $format = null, array $context = [])
{
if (isset($data->{'$ref'})) {
return new Reference($data->{'$ref'}, $context['rootSchema'] ?: null);
}
$object = new \Joli\Jane\OpenApi\Model\FileSchema();
if (!isset($context['rootSchema'])) {
$context['rootSchema'] = $object;
}
if (property_exists($data, 'format')) {
$object->setFormat($data->{'format'});
}
if (property_exists($data, 'title')) {
$object->setTitle($data->{'title'});
}
if (property_exists($data, 'description')) {
$object->setDescription($data->{'description'});
}
if (property_exists($data, 'default')) {
$object->setDefault($data->{'default'});
}
if (property_exists($data, 'required')) {
$values = [];
foreach ($data->{'required'} as $value) {
$values[] = $value;
}
$object->setRequired($values);
}
if (property_exists($data, 'type')) {
$object->setType($data->{'type'});
}
if (property_exists($data, 'readOnly')) {
$object->setReadOnly($data->{'readOnly'});
}
if (property_exists($data, 'externalDocs')) {
$object->setExternalDocs($this->serializer->deserialize($data->{'externalDocs'}, 'Joli\\Jane\\OpenApi\\Model\\ExternalDocs', 'raw', $context));
}
if (property_exists($data, 'example')) {
$object->setExample($data->{'example'});
}
return $object;
}