Skip to content

Conversation

@IKancijan
Copy link

While parsing a template, some of the model's default values break the output. Any invalid properties should be dealt with subsequently

IKancijan added 2 commits June 7, 2022 08:20
When parsing a template, some of the models default values break the video. Any invalid properties should be dealt subsequently
Deserializer can now find proper asset model
@jeffski
Copy link
Contributor

jeffski commented Jun 8, 2022

Thanks will investigate this request, we are aware parsing a template has some issues, particularly around the assets. The default values can be set to null potentially. The ObjectSerializer file is generated by the OpenAPI Generator so it makes it more difficult to change that but will look in to it.

Do you have an example PHP script that will recreate your errors, so we can accelerate the investigation and test.

@IKancijan
Copy link
Author

Unfortunately, I don't have a standalone script, but it's easy to recreate.
I'm using one of your templates (https://shotstack.io/templates/startup-presentation/) JSON. I've extended ObjectSerializer and tweaked the deserialize() method you can see in this PR.
Now, default model properties are assigned on construct which adds default values to properties that don't seem to be required by your documentation (fit, background, position...) and rendered media looks broken.
I can set them to null, but unless I cross-reference the JSON template, I can't know if a value is valid or not.

@jeffski
Copy link
Contributor

jeffski commented Jun 12, 2022

@IKancijan I had a quick look at this and it works nicely. I was able to get it to work without setting all the default values to null in the assets and timeline. I used the startup presentation JSON file as an example and it all seemed to work OK. Please can you confirm if there are cases where those values need to be set as null?

@IKancijan
Copy link
Author

@jeffski sorry for waiting.
The problem is when I deserialize the template, I get values like "fit" => "crop" which are added by default if "fit" is not set in the template and that causes problems. I know adding a proper "fit" value solves the problem, but if I can render a video without them, I should be able to deserialize the template without default values being added, no?

@jeffski
Copy link
Contributor

jeffski commented Aug 15, 2022

We have just released this: https://github.com/shotstack/shotstack-sdk-php/releases/tag/v0.2.2.

It sets all the values to null and does not set defaults. It still doesn't fix the issue with serializing but will investigate that one soon.

@IKancijan
Copy link
Author

Thank you!

@IKancijan IKancijan closed this Aug 18, 2022
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

Successfully merging this pull request may close these issues.

2 participants