Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error during deserialization of asset "background" property #34

Open
wirabelle opened this issue Nov 2, 2024 · 0 comments
Open

Error during deserialization of asset "background" property #34

wirabelle opened this issue Nov 2, 2024 · 0 comments

Comments

@wirabelle
Copy link

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'];
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant