Skip to content

Conversation

anushakolan
Copy link
Contributor

Why make this change?

  • Adds support for entity-level descriptions in Data API Builder GraphQL schema.
  • This feature request aims to surface entity descriptions from the config file in the generated GraphQL schema, improving API documentation and discoverability.
  • See related discussion: [https://github.com/[Enh]: Add entity description (metadata) #2834]

What is this change?

  • Adds a description property to the entity model and ensures it is deserialized from the config.
  • Updates the GraphQL schema generator and converter to include entity descriptions as comments in the SDL and as HotChocolate type descriptions.
  • Adds unit tests to verify that entity descriptions appear in the generated schema.

How was this tested?

  • Unit Tests: Added tests to check for presence of entity description in generated GraphQL schema.
  • Manual verification: Ran GraphQL introspection queries and checked schema SDL output.

Sample Request(s)

GraphQL Introspection Query:

{
  __type(name: "Todo") {
    name
    description
  }
}

Sample Query Response:

{
  "data": {
    "__type": {
      "name": "Todo",
      "description": "Represents a todo item in the system"
    }
  }
}

Sample SDL output:

"""Represents a todo item in the system"""
type Todo {
  ...
}

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for entity descriptions in Data API Builder's GraphQL schema generation. The feature allows developers to include descriptive comments in their configuration that will be surfaced as documentation in the generated GraphQL schema.

  • Adds a description property to the Entity model for storing entity-level documentation
  • Updates GraphQL schema generators to include entity descriptions as GraphQL comments and HotChocolate type descriptions
  • Adds JSON schema validation and unit tests for the new description functionality

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Config/ObjectModel/Entity.cs Adds optional Description property to Entity record
src/Core/Generator/SchemaGenerator.cs Updates Cosmos DB schema generator to include entity descriptions as GraphQL comments
src/Service.GraphQLBuilder/Sql/SchemaConverter.cs Updates SQL schema converter to include entity descriptions in GraphQL type definitions
schemas/dab.draft.schema.json Adds JSON schema definition for the new description property
src/Service.Tests/SqlTests/GraphQLQueryTests/MsSqlGraphQLQueryTests.cs Adds unit test to verify entity descriptions appear in generated GraphQL schema

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@anushakolan anushakolan self-assigned this Sep 4, 2025
@anushakolan
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Microsoft"

@RubenCerna2079
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

Copy link
Contributor

@souvikghosh04 souvikghosh04 left a comment

Choose a reason for hiding this comment

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

LGTM

@anushakolan anushakolan force-pushed the dev/anushakolan/mcp/add-entity-description branch from 3fb3cc5 to e33142f Compare September 10, 2025 17:46
@anushakolan anushakolan changed the title [DAB-MCP] Added description property to entities and GraphQL Schema. [MCP] Added description property to entities and GraphQL Schema. Sep 10, 2025
Copy link
Contributor

@aaronburtle aaronburtle left a comment

Choose a reason for hiding this comment

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

Looks good, might want to add a test case for edge case like empty string, make sure it behaves as desired.

@anushakolan
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@anushakolan anushakolan enabled auto-merge (squash) September 12, 2025 23:36
@anushakolan
Copy link
Contributor Author

/azp run

Copy link

Azure Pipelines successfully started running 6 pipeline(s).

@anushakolan anushakolan merged commit 51f672f into main Sep 15, 2025
11 checks passed
@anushakolan anushakolan deleted the dev/anushakolan/mcp/add-entity-description branch September 15, 2025 16:56
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.

4 participants