Skip to content

Error during deserialization of asset "background" property #34

@wirabelle

Description

@wirabelle

The asset background property is configured as a string, but deserialize receive stdClass object instead.

Dump

src/ObjectSerializer.php#L495

$data : {#1642 ▼
  +"padding": 0
  +"color": "#FFFFFF"
  +"opacity": 1
  +"borderRadius": 0
}
$class : "string"

Log

Object of class stdClass could not be converted to string

  at vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:498
  at settype(object(stdClass), 'string')
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:498)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), 'string', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\Asset', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\Clip', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:420)
  at Shotstack\Client\ObjectSerializer::deserialize(array(object(stdClass)), '\\Shotstack\\Client\\Model\\Clip[]', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\Track', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:420)
  at Shotstack\Client\ObjectSerializer::deserialize(array(object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass), object(stdClass)), '\\Shotstack\\Client\\Model\\Track[]', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\Timeline', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\Edit', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\RenderResponseData', null)
     (vendor/shotstack/shotstack-sdk-php/src/ObjectSerializer.php:544)
  at Shotstack\Client\ObjectSerializer::deserialize(object(stdClass), '\\Shotstack\\Client\\Model\\RenderResponse', array())
     (vendor/shotstack/shotstack-sdk-php/src/Api/EditApi.php:483)
  at Shotstack\Client\Api\EditApi->getRenderWithHttpInfo('xxx', null, null, 'application/json')
     (vendor/shotstack/shotstack-sdk-php/src/Api/EditApi.php:402)
  at Shotstack\Client\Api\EditApi->getRender('xxx')

Temp fix
I created a temporary function to bypass the deserializer.

    public function getRenderRaw(string $id): array
    {
        $request = $this->editApi->getRenderRequest($id);
        $result = (new Client())->send($request);
        $result = json_decode($result->getBody()->getContents(), true);

        return $result['response'];
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions