@@ -418,6 +418,28 @@ def test_schema_generation_resolves_attachments_pydantic_dataclass(
418418 ) -> None :
419419 """Test that attachments are resolved in entry-points schema"""
420420
421+ def verify_attachment_schema (schema , verify_other_field ):
422+ assert "definitions" in schema
423+ assert "job-attachment" in schema ["definitions" ]
424+ assert schema ["definitions" ]["job-attachment" ]["type" ] == "object"
425+ assert (
426+ schema ["definitions" ]["job-attachment" ]["x-uipath-resource-kind" ]
427+ == "JobAttachment"
428+ )
429+ assert all (
430+ prop_name in schema ["definitions" ]["job-attachment" ]["properties" ]
431+ for prop_name in ["ID" , "FullName" , "MimeType" , "Metadata" ]
432+ )
433+ if not verify_other_field :
434+ return
435+
436+ assert len (schema ["properties" ]) == 2
437+ assert all (
438+ prop_name in schema ["properties" ]
439+ for prop_name in ["input_file" , "other_field" ]
440+ )
441+ assert schema ["required" ] == ["input_file" ]
442+
421443 with runner .isolated_filesystem (temp_dir = temp_dir ):
422444 with open ("main.py" , "w" ) as f :
423445 f .write (f"""
@@ -435,30 +457,10 @@ def main(input: InputModel) -> InputModel: return input""")
435457 assert "Created 'bindings.json' file" in result .output
436458 assert "Created 'entry-points.json' file" in result .output
437459
438- # Verify entry-points.json contains attachments definition
439460 with open ("entry-points.json" , "r" ) as f :
440461 entrypoints = json .load (f )
441462 input_schema = entrypoints ["entryPoints" ][0 ]["input" ]
442- assert "definitions" in input_schema
443- assert "job-attachment" in input_schema ["definitions" ]
444- assert input_schema ["definitions" ]["job-attachment" ]["type" ] == "object"
445- assert (
446- input_schema ["definitions" ]["job-attachment" ][
447- "x-uipath-resource-kind"
448- ]
449- == "JobAttachment"
450- )
451- assert all (
452- prop_name
453- in input_schema ["definitions" ]["job-attachment" ]["properties" ]
454- for prop_name in ["ID" , "FullName" , "MimeType" , "Metadata" ]
455- )
456- if not verify_other_field :
457- return
463+ output_schema = entrypoints ["entryPoints" ][0 ]["output" ]
458464
459- assert len (input_schema ["properties" ]) == 2
460- assert all (
461- prop_name in input_schema ["properties" ]
462- for prop_name in ["input_file" , "other_field" ]
463- )
464- assert input_schema ["required" ] == ["input_file" ]
465+ verify_attachment_schema (input_schema , verify_other_field )
466+ verify_attachment_schema (output_schema , verify_other_field )
0 commit comments