Skip to content

Commit 8f716fc

Browse files
fix(graphql): ensure correct object types are set in schema #623
1 parent d8e68bc commit 8f716fc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Schemas/GraphQLSchema.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ class GraphQLSchema extends Schema {
216216
foreach ($model->get_fields() as $field) {
217217
# For NestedModelFields, ensure we pass the Type for the nested Model
218218
if ($model->$field instanceof NestedModelField) {
219-
$nested_model_type = $this->get_model_input_object_type($model->$field->model_class);
219+
if ($input) {
220+
$nested_model_type = $this->get_model_input_object_type($model->$field->model_class);
221+
}
222+
else {
223+
$nested_model_type = $this->get_model_object_type($model->$field->model_class);
224+
}
220225
$fields[$field]['type'] = $this->field_to_type(field: $model->$field, type: $nested_model_type);
221226
$fields[$field]['description'] = $model->$field->help_text;
222227
continue;

0 commit comments

Comments
 (0)