Idea for safely serializing JSON data #122
crowecawcaw
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
type: TEXTembedded files are the only main way Deadline Cloud integrations pass structured config (init-data, run-data) to adaptors. Template authors write YAML as raw text with{{Param.*}}placeholders, and the runtime does raw text substitution after serialization. If the substituted value contains characters that break the YAML quoting chosen at serialization time, the worker gets a parse error.Example
{{requires YAML quoting, so the serializer single-quotes the value. When the path/Users/artist's work/scene.c4dis substituted, the result is:Broken YAML — the apostrophe terminates the string early.
Affected templates
Many Deadline Cloud integrations create YAML files as strings like this. Taking C4D as the sample, the fix required a custom
_yaml_utils.pymodule that splits values into "safe for yaml_dump" vs "must be unquoted plain scalars". Every plugin would need to replicate this.Why
repr_json()from RFC 6 isn't sufficientrepr_json()can wrap individual values safely — JSON double-quoted strings are valid YAML:This handles apostrophes, double quotes, backslashes, colon-space,
#, empty strings, etc. correctly. It's a viable near-term mitigation.But it has two drawbacks:
Proposed solution:
type: JSONembedded filesAdd a new embedded file variants where
datais a structured object rather than raw text. The runtime resolves{{Param.*}}at the value level, then serializes the result to JSON when writing the file.Schema
(JSON is valid YAML, so it will solve the YAML use case as well.)
Example
The serializer handles quoting correctly because substitution happens on the parsed data structure, not inside a serialized text blob.
Why this over
repr_json()<EmbeddedFile>already has atypediscriminatorReferences
<EmbeddedFileText>spec: §6.1repr_json()): RFC 0006Beta Was this translation helpful? Give feedback.
All reactions