Skip to content

Add description support for schema documentation - #6

Open
rnsmith wants to merge 1 commit into
mainfrom
add-schema-descriptions
Open

rnsmith wants to merge 1 commit into
mainfrom
add-schema-descriptions

Conversation

@rnsmith

@rnsmith rnsmith commented Sep 22, 2026

Copy link
Copy Markdown

Summary

  • Adds an optional description= kwarg to ObjectType, InterfaceType, InputObjectType, field(), param(), and input_field()
  • Propagates those descriptions into the generated GraphQLObjectType / GraphQLInterfaceType / GraphQLInputObjectType / GraphQLField / GraphQLArgument / GraphQLInputField in create_graphql_schema, so they surface in introspection and GraphiQL
  • Bumps version to 0.5.0

Needed by the knowledge-base app, which wants to start documenting its GraphQL schema (starting with the top-level diseases query) but currently has nowhere to attach a description — graphlayer drops it silently today.

Test plan

  • pytest tests/ — 276 passed (270 existing + 6 new covering description propagation for object/interface/input-object types, fields, params, and input fields)

…, fields, params and input fields

Threads an optional description= kwarg through the graph-side schema
builders (ObjectType, InterfaceType, InputObjectType, field, param,
input_field) and propagates it into the generated GraphQLObjectType /
GraphQLInterfaceType / GraphQLInputObjectType / GraphQLField /
GraphQLArgument / GraphQLInputField, so descriptions show up in
introspection and GraphiQL.

Bump version to 0.5.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 22, 2026 11:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The updated GraphQL schema generation still omits default_value for arguments/input fields, dropping defaults from the generated schema despite existing has_default handling.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Adds first-class description= support across GraphLayer schema definitions and ensures those descriptions propagate into the generated graphql-core schema objects so they appear in introspection/GraphiQL.

Changes:

  • Adds optional description to schema building blocks (ObjectType, InterfaceType, InputObjectType, field, param, input_field).
  • Propagates descriptions into generated GraphQL* types/fields/arguments/input-fields.
  • Adds tests for description propagation and bumps package version to 0.5.0.
File Description
graphlayer/​schema.py Introduces description fields on schema objects (types/fields/params/input-fields).
graphlayer/​graphql/​schema.py Passes description into generated graphql-core schema objects.
tests/​graphql/​test_schema.py Adds coverage asserting description propagation into GraphQL schema objects and updates matchers accordingly.
setup.py Updates package version to 0.5.0.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines 88 to +91
if graph_field.has_default and isinstance(graphql_type, graphql.GraphQLNonNull):
graphql_type = graphql_type.of_type

return graphql.GraphQLInputField(type_=graphql_type)
return graphql.GraphQLInputField(type_=graphql_type, description=graph_field.description)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants