Skip to content

[Repo Assist] improve: surface schema description as XmlDoc on generated object and enum types (+5 tests, 348→353)#419

Merged
sergey-tihon merged 4 commits into
masterfrom
repo-assist/improve-type-xmldoc-20260502-fa56eb9fbab1a79d
May 2, 2026
Merged

[Repo Assist] improve: surface schema description as XmlDoc on generated object and enum types (+5 tests, 348→353)#419
sergey-tihon merged 4 commits into
masterfrom
repo-assist/improve-type-xmldoc-20260502-fa56eb9fbab1a79d

Conversation

@github-actions

@github-actions github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

Properties and operation methods already carry TypeProviderXmlDocAttribute from their schema description fields, giving IDE tooltips for individual members. However, the generated types themselves (object types and CLI enum types) did not receive any XmlDoc — even when the component schema had a top-level description.

This PR adds that missing step:

  • Object types: after creating the ProvidedTypeDefinition, call AddXmlDoc when schemaObj.Description is non-null/non-whitespace.
  • Named enum types: same treatment, applied immediately after SetEnumUnderlyingType.

Example

components:
  schemas:
    Status:
      type: string
      description: "The lifecycle status of an item"
      enum: [active, inactive, pending]
    Pet:
      type: object
      description: "A pet registered in the system"
      properties:
        name:
          type: string
```

After this change, hovering over `Status` or `Pet` in F# code will show the description in IDE tooltips, consistent with the existing behaviour for their properties/members.

## Changes

| File | Change |
|------|--------|
| `src/SwaggerProvider.DesignTime/DefinitionCompiler.fs` | Add `AddXmlDoc` call after object type creation and enum type creation |
| `tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs` | +5 `[<Fact>]` tests covering object types and enum types with/without descriptions |

## Test Status

Build succeeded; all **353 tests pass** (up from 348 before this change, +5 new tests).

```
=== TEST EXECUTION SUMMARY ===
   SwaggerProvider.Tests  Total: 353, Errors: 0, Failed: 0, Skipped: 1, Not Run: 0, Time: 1.065s

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@3de4e604a36b5190a1c7dc4719c7341500ba8a95

… enum types (+5 tests, 348->353)

When an OpenAPI component schema has a top-level `description` field, the
generated ProvidedTypeDefinition (both object types and CLI enum types) now
gets that description as a TypeProviderXmlDocAttribute.  This means IDE
tooling (IntelliSense / F# tooltips) will show the schema description when
hovering over a generated type, matching the existing behaviour for property
and operation-method descriptions.

Changes:
- DefinitionCompiler.fs: call `AddXmlDoc` on generated object types and
  named enum types when `schemaObj.Description` is non-null/non-whitespace
- Schema.XmlDocTests.fs: 5 new Fact tests covering both object types and
  enum types with and without descriptions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review May 2, 2026 16:04
Copilot AI review requested due to automatic review settings May 2, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds missing type-level XmlDoc generation so top-level OpenAPI schema description fields surface in IDE tooltips for generated object and named enum types, aligning type tooltips with existing member-level XmlDoc behavior.

Changes:

  • Add AddXmlDoc for generated object types when schemaObj.Description is present.
  • Add AddXmlDoc for generated top-level named enum types (string/int) when schemaObj.Description is present.
  • Add 5 tests validating XmlDoc presence/absence on generated types.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/SwaggerProvider.DesignTime/DefinitionCompiler.fs Attaches schema description as XmlDoc on generated object and named enum types.
tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs Adds coverage ensuring type-level XmlDoc is emitted only when descriptions exist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/SwaggerProvider.DesignTime/DefinitionCompiler.fs Outdated
Comment thread src/SwaggerProvider.DesignTime/DefinitionCompiler.fs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sergey-tihon

Copy link
Copy Markdown
Member

@copilot fix formatting and build

Copilot AI commented May 2, 2026

Copy link
Copy Markdown
Contributor

@copilot fix formatting and build

Fixed in 5e1941e — applied Fantomas formatting to DefinitionCompiler.fs. All 353 tests pass.

Copilot AI requested a review from sergey-tihon May 2, 2026 16:43
@sergey-tihon sergey-tihon merged commit 095ba39 into master May 2, 2026
2 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/improve-type-xmldoc-20260502-fa56eb9fbab1a79d branch May 2, 2026 17:44
github-actions Bot added a commit that referenced this pull request May 3, 2026
Documents improvements since beta03:
- surface schema description as XmlDoc on generated types (#419)
- add <returns> XmlDoc tag for operation response descriptions
- eng: bump Microsoft.OpenApi and YamlReader 2.7.4

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants