Skip to content

Commit 7856ae9

Browse files
test(GraphQL): ensure conditionally required fields can always be queried #778
1 parent 511e8f2 commit 7856ae9

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsGraphQLTestCase.inc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,17 @@ class APIModelsGraphQLTestCase extends TestCase {
388388
},
389389
);
390390
}
391+
392+
/**
393+
* Ensure we can query for model fields that are conditionally required. Regression test for #778
394+
*/
395+
public function test_query_conditionally_required_field(): void {
396+
# Query for interfaces including conditionally required fields and ensure no errors are returned.
397+
$graphql = new GraphQL(
398+
query: 'query {queryInterfaces {id ipaddr subnet descr typev4 track6_interface}}',
399+
client: $this->auth
400+
);
401+
$graphql->create();
402+
$this->assert_is_empty($graphql->result->value['errors'] ?? []);
403+
}
391404
}

0 commit comments

Comments
 (0)