Skip to content

[Repo Assist] improve: surface enum allowed-values in operation parameter XmlDocs (+3 tests, 324→327)#398

Merged
sergey-tihon merged 3 commits intomasterfrom
repo-assist/improve-enum-param-xmldoc-2026-04-23-0c9faaf4557070b8
Apr 24, 2026
Merged

[Repo Assist] improve: surface enum allowed-values in operation parameter XmlDocs (+3 tests, 324→327)#398
sergey-tihon merged 3 commits intomasterfrom
repo-assist/improve-enum-param-xmldoc-2026-04-23-0c9faaf4557070b8

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

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

Summary

OpenAPI parameters with enum values (query, path, header, cookie) now include an "Allowed values: ..." hint in their IntelliSense <param> tag, consistent with what already happens for object properties.

Before

/// <summary>List items</summary>
/// <param name="status">Filter by status</param>
```

### After

```
/// <summary>List items</summary>
/// <param name="status">Filter by status
/// Allowed values: active, inactive, pending</param>
```

## Changes

| File | Change |
|---|---|
| `Utils.fs` | Extract `XmlDoc.buildEnumDoc` helper — formats a `JsonNode` enum list into an "Allowed values: ..." string |
| `DefinitionCompiler.fs` | Replace inline `formatEnumValue` / `enumValuesDoc` with a call to `XmlDoc.buildEnumDoc` (no behaviour change for property docs) |
| `OperationCompiler.fs` | Add `buildParamDesc` in the `xmlDoc` block — appends enum allowed-values to each parameter description |
| `Schema.XmlDocTests.fs` | Refactor helpers (`parseSchema`, `getXmlDocAttr`, `getMethodXmlDoc`); add 3 new tests for the operation-parameter enum doc feature |

## Test Status

✅ **327 / 327 tests pass** (up from 324 — 3 new tests added)

```
SwaggerProvider.Tests  Total: 327, Errors: 0, Failed: 0, Skipped: 1, Not Run: 0, Time: 0.923s

Format check: ✅ fantomas --check passes on all changed files.

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

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@96b9d4c39aa22359c0b38265927eadb31dcf4e2a

…+3 tests, 324→327)

Extract the enum-value formatter from DefinitionCompiler into a shared
XmlDoc.buildEnumDoc helper in Utils.fs, then use it in both places:

- DefinitionCompiler already added 'Allowed values: ...' to object
  property XmlDocs; this PR refactors the local formatEnumValue function
  out to the shared module (no behaviour change for properties).
- OperationCompiler now also adds enum value hints to the <param> tags
  in generated method XmlDocs, so IntelliSense shows valid values for
  query/path/header/cookie parameters that have an enum schema.

Before:
  /// <summary>List items</summary>
  /// <param name="status">Filter by status</param>

After:
  /// <summary>List items</summary>
  /// <param name="status">Filter by status
  /// Allowed values: active, inactive, pending</param>

Also refactors Schema.XmlDocTests.fs: extract parseSchema / getXmlDocAttr
helpers to eliminate duplication and add a getMethodXmlDoc helper used by
3 new tests covering the operation-parameter enum doc feature.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon marked this pull request as ready for review April 24, 2026 04:25
Copilot AI review requested due to automatic review settings April 24, 2026 04:25
Copy link
Copy Markdown
Contributor

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

Surfaces OpenAPI enum allowed-values as an “Allowed values: …” hint in generated IntelliSense XML docs for operation parameters, aligning with existing behavior for schema properties.

Changes:

  • Extracted a shared XmlDoc.buildEnumDoc helper to format enum value lists.
  • Reused XmlDoc.buildEnumDoc for schema property XmlDocs (no intended behavior change).
  • Appended enum allowed-values to operation parameter descriptions in OperationCompiler, with 3 new tests covering the new behavior.

Reviewed changes

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

File Description
tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs Refactors schema parsing / XmlDoc extraction helpers and adds tests validating enum hints in method <param> docs.
src/SwaggerProvider.DesignTime/Utils.fs Introduces XmlDoc.buildEnumDoc to format enum values consistently across compilers.
src/SwaggerProvider.DesignTime/OperationCompiler.fs Adds enum allowed-values into operation parameter XmlDoc content via buildParamDesc.
src/SwaggerProvider.DesignTime/DefinitionCompiler.fs Replaces inline enum doc formatting with the shared XmlDoc.buildEnumDoc helper.

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

Comment thread tests/SwaggerProvider.Tests/Schema.XmlDocTests.fs Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@sergey-tihon sergey-tihon merged commit deb9d9f into master Apr 24, 2026
2 checks passed
@sergey-tihon sergey-tihon deleted the repo-assist/improve-enum-param-xmldoc-2026-04-23-0c9faaf4557070b8 branch April 24, 2026 15:57
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.

2 participants