From 1fda5d846b02f25eada1f0de7aaedc6c207845af Mon Sep 17 00:00:00 2001 From: Ben Bartrim Date: Mon, 2 Sep 2024 09:00:39 -0700 Subject: [PATCH] fix missing field descriptions in graphql (#2074) * fix missing field descriptions in graphql * respect parser field description settings * ignore coverage --------- Co-authored-by: Koudai Aono --- datamodel_code_generator/parser/graphql.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datamodel_code_generator/parser/graphql.py b/datamodel_code_generator/parser/graphql.py index bf19d4e26..6d79e8bf6 100644 --- a/datamodel_code_generator/parser/graphql.py +++ b/datamodel_code_generator/parser/graphql.py @@ -407,6 +407,9 @@ def parse_field( else self.default_field_extras.copy() ) + if field.description is not None: # pragma: no cover + extras['description'] = field.description + return self.data_model_field_type( name=field_name, default=default, @@ -416,7 +419,7 @@ def parse_field( alias=alias, strip_default_none=self.strip_default_none, use_annotated=self.use_annotated, - use_field_description=field.description is not None, + use_field_description=self.use_field_description, use_default_kwarg=self.use_default_kwarg, original_name=field_name, has_default=default is not None,