cog
cc128017 - fix: support list[X] | None inputs + integration tests for PEP 604 union File/Path coercion (#2882)

Commit
110 days ago
fix: support list[X] | None inputs + integration tests for PEP 604 union File/Path coercion (#2882) * test: add integration tests for PEP 604 union File/Path coercion Add five txtar integration tests verifying that coglet correctly handles PEP 604 pipe-union syntax (X | None) for File and Path input coercion: - pep604_file_or_none_input: File | None via predict + serve - pep604_path_or_none_input: Path | None via predict + serve - pep604_list_file_or_none_input: list[File] | None via predict + serve - pep604_list_path_or_none_input: list[Path] | None via predict + serve - pep604_string_url_not_coerced: str | None with URL is NOT coerced (negative) * fix: support list[X] | None (optional repeated) inputs in SDK and schema gen The Python SDK and Go static schema generator only supported three Repetition variants (Required, Optional, Repeated), so type annotations like `list[File] | None` and `list[Path] | None` would fail: - Python SDK raised "Optional cannot have nested type list" - Go schema gen silently discarded the list semantics, producing an optional scalar schema instead of a nullable array Add OptionalRepeated to both type systems, threading it through type resolution, normalization, JSON schema generation, and input validation. * fix: correct integration test assertions for list File/Path types cog.File objects are BytesIO at runtime (not 'File'), and cog.Path reports as 'Path' (not 'PosixPath'). Check count and content instead of type names, matching the pattern used by the single-element tests. * fix: strip trailing newlines from file content in list input tests txtar file sections include trailing newlines, which leak into the joined output string causing a line break that the stdout matcher can't match across. Strip content before joining. * test: add positive HTTP coercion assertions for pep604 file/path unions (#2893) --------- Co-authored-by: Eray <37340907+erayack@users.noreply.github.com>
Author
Parents
Loading