Skip to content

Add OpenAPI 3 documentation through the existing REST pipeline - #11154

Draft
vicancy wants to merge 18 commits into
dotnet:mainfrom
vicancy:lianwei-microsoft-openapi-net-integration
Draft

vicancy wants to merge 18 commits into
dotnet:mainfrom
vicancy:lianwei-microsoft-openapi-net-integration

Conversation

@vicancy

@vicancy vicancy commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Add OpenAPI 3.0, 3.1 and 3.2 JSON/YAML documentation using Microsoft.OpenApi and Microsoft.OpenApi.YamlReader 3.10.2. Related to #11151; builds on the Swagger 2.0 compatibility coverage in #11152 and #11181.

Shared document input probes JSON/YAML protocol markers and YamlMime once for processor selection and loading. Existing YamlMime processors use the same input. REST dispatch selects the existing Swagger 2.0 parser/converter or the OpenAPI 3 adapter; protocol readers receive the detected version and input instead of reopening the root file. Both produce the existing REST view models with extensible metadata dictionaries. The specification version is recorded separately from the API's info.version. Swagger 2.0 metadata access, split-page inheritance, overwrite behavior and allOf rendering retain their existing contracts.

The shared template transform and partials display operations, parameters, request bodies, responses, schemas and examples. OpenAPI 3 description markup visits the documented fields while preserving literal JSON. Coverage includes server overrides, references and cycles within one document, typed constants, null defaults, boolean schemas, and OpenAPI 3.2 QUERY/custom methods, streaming itemSchema and dataValue/serializedValue examples. Generated 3.0 and 3.2 examples are included in the documentation navigation.

Cross-file and network $ref targets are deferred and produce UnsupportedExternalReference. Known lossy OpenAPI 3.0 compositions are rejected, and features without dedicated documentation UI produce warnings. The documentation describes these limits.

Suggested review order:

  1. Shared document input, JSON/YAML detection and processor dispatch.
  2. The OpenAPI 3 adapter, metadata description markup and overwrite handling.
  3. Shared template extensions, generated examples and compatibility tests.

Validation:

  • 165 reader/model tests and 43 HTML/splitting tests pass on each of .NET 8 and .NET 10, including the unchanged Swagger 2.0 compatibility baseline.
  • Shared input tests pass on .NET 8 and .NET 10. Existing YAML processor and build integration suites pass on .NET 10; three existing remote xref tests remain skipped.
  • All 17 JavaScript tests, template lint and template build pass.
  • Documentation build succeeds with zero warnings/errors; both example pages and the updated feature-limit page are served by the local preview.

vicancy and others added 8 commits September 19, 2026 17:30
Characterize existing Swagger parsing, document processing and rendered outputs before the OpenAPI v3 work. Preserve golden outputs recorded with unchanged production code at bd097d0.

Related to dotnet#11151

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Replace seven full output snapshots with focused model, DOM, xref, page and TOC assertions while retaining real template builds and existing scenarios.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercise pure converter contracts with in-memory models, retain file-backed parser coverage, and separate suffix recognition from representative naming builds. Skip unused reference fixtures and file setup for classification paths that do not read content.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use the maintained OpenAPI reader and typed models for OpenAPI 3.0 and 3.1 core JSON/YAML documentation while retaining the legacy Swagger 2.0 compatibility path. Load local document graphs through SDK workspaces and report known SDK fidelity limits explicitly.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: aaccfe95-0a86-417b-9883-a37fd53bd705
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: aaccfe95-0a86-417b-9883-a37fd53bd705
@vicancy
vicancy marked this pull request as ready for review September 24, 2026 09:01
@vicancy
vicancy marked this pull request as draft September 24, 2026 10:21
@vicancy vicancy changed the title Add OpenAPI.NET-backed REST documentation Add OpenAPI 3 documentation with shared REST view models Sep 24, 2026
@vicancy vicancy changed the title Add OpenAPI 3 documentation with shared REST view models Add OpenAPI 3 documentation through the existing REST pipeline Sep 24, 2026

This branch has not been deployed

No deployments
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.

1 participant