Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
majdyz committed Dec 26, 2024
1 parent a389d13 commit 2fa5fda
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion autogpt_platform/backend/backend/data/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ def _generate_schema(
"properties": {
p.name: {
"secret": p.secret,
"advanced": p.advanced,
# Default value has to be set for advanced fields.
"advanced": p.advanced and p.value is not None,
"title": p.title or p.name,
**({"description": p.description} if p.description else {}),
**({"default": p.value} if p.value is not None else {}),
Expand Down
6 changes: 3 additions & 3 deletions autogpt_platform/backend/test/data/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ async def test_get_input_schema(server: SpinTestServer):

class ExpectedInputSchema(BlockSchema):
in_key_a: Any = SchemaField(title="Key A", default="A", advanced=True)
in_key_b: Any = SchemaField(
title="in_key_b", advanced=False
) # no default value
in_key_b: Any = SchemaField(title="in_key_b", advanced=False)

class ExpectedOutputSchema(BlockSchema):
out_key: Any = SchemaField(
Expand All @@ -157,6 +155,8 @@ class ExpectedOutputSchema(BlockSchema):

input_schema = created_graph.input_schema
input_schema["title"] = "ExpectedInputSchema"
print(">>>> input_schema", input_schema)
print(">>>> ExpectedInputSchema", ExpectedInputSchema.jsonschema())
assert input_schema == ExpectedInputSchema.jsonschema()

output_schema = created_graph.output_schema
Expand Down

0 comments on commit 2fa5fda

Please sign in to comment.