Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new line before field description #20

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion graphene_federation/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def add_entity_fields_decorators(entity, schema: Schema, string_schema: str) ->
"""
entity_name = entity._meta.name
entity_type = schema.graphql_schema.get_type(entity_name)
str_fields = []
str_fields: List[str] = []
get_model_attr = field_name_to_type_attribute(schema, entity)
for field_name, field in (
entity_type.fields.items() if getattr(entity_type, "fields", None) else []
Expand All @@ -83,6 +83,8 @@ def add_entity_fields_decorators(entity, schema: Schema, string_schema: str) ->
decorator_value = getattr(f, decorator, None)
if decorator_value:
str_field += f" {decorator_resolver(schema, decorator_value)}"
if str_fields and str_field.lstrip().startswith('"""'):
str_field = f"\n{str_field}"
str_fields.append(str_field)
str_fields_annotated = "\n".join(str_fields)
# Replace the original field declaration by the annotated one
Expand Down