Skip to content

Refactor documentation and update OpenApiWeaverDocument logic#27

Merged
shibayan merged 1 commit into
masterfrom
msbuild-prop
Mar 31, 2026
Merged

Refactor documentation and update OpenApiWeaverDocument logic#27
shibayan merged 1 commit into
masterfrom
msbuild-prop

Conversation

@shibayan

Copy link
Copy Markdown
Owner

This pull request removes support for using AdditionalFiles directly to include OpenAPI documents, requiring the use of the OpenApiWeaverDocument item instead. The change clarifies and enforces the intended configuration pattern, updates documentation and tests, and ensures only files explicitly marked as OpenApiWeaverDocument are processed by the source generator.

Configuration and Build System Changes:

  • The MSBuild targets now map OpenApiWeaverDocument items to AdditionalFiles with a special metadata marker (OpenApiWeaverItemKind=Document), and the source generator only processes files with this marker. This prevents accidental processing of unrelated AdditionalFiles. (src/OpenApiWeaver/buildTransitive/OpenApiWeaver.targets [1] samples/SampleApp/SampleApp.csproj [2]
  • The generator logic is updated to filter files based on the new metadata, ignoring all AdditionalFiles that are not explicitly marked as OpenApiWeaverDocument. (src/OpenApiWeaver/OpenApiWeaverSourceGenerator.cs [1] [2] [3]

Documentation Updates:

  • All documentation and README references to using AdditionalFiles directly have been removed or updated to reflect the new required usage of OpenApiWeaverDocument. (README.md [1] [2]; docs/configuration.md [3] [4]; docs/getting-started.md [5] [6]

Testing Improvements:

  • Tests have been updated to use the correct metadata keys and new item kind, and a new test ensures that ordinary AdditionalFiles are ignored by the generator. (tests/OpenApiWeaver.Tests/OpenApiWeaverSourceGeneratorTests.Configuration.cs [1] [2] [3]; tests/OpenApiWeaver.Tests/OpenApiWeaverSourceGeneratorTests.cs [4] [5] [6] [7]

Sample Project Update:

These changes make the inclusion of OpenAPI documents more explicit and robust, reducing the risk of misconfiguration and improving maintainability.

…date generator logic for OpenApiWeaverDocument
@shibayan shibayan requested a review from Copilot March 31, 2026 12:38
@shibayan shibayan self-assigned this Mar 31, 2026
@shibayan shibayan added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 31, 2026

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

This PR tightens how OpenAPI documents are discovered by the source generator by removing implicit support for arbitrary AdditionalFiles and requiring explicit inclusion via the OpenApiWeaverDocument MSBuild item (mapped into AdditionalFiles with an OpenApiWeaverItemKind=Document marker). This aligns generator behavior with the intended configuration model and reduces accidental processing of unrelated AdditionalFiles.

Changes:

  • Update MSBuild transitive targets to map OpenApiWeaverDocumentAdditionalFiles and emit a compiler-visible OpenApiWeaverItemKind marker.
  • Update generator discovery logic to only process OpenAPI files that carry the OpenApiWeaverItemKind=Document metadata.
  • Update docs, sample project, and tests (including a new test ensuring unmarked AdditionalFiles are ignored).

Reviewed changes

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

Show a summary per file
File Description
tests/OpenApiWeaver.Tests/OpenApiWeaverSourceGeneratorTests.cs Extends test harness to simulate the new OpenApiWeaverItemKind-gated discovery behavior.
tests/OpenApiWeaver.Tests/OpenApiWeaverSourceGeneratorTests.Configuration.cs Renames/updates configuration tests and adds coverage asserting unmarked AdditionalFiles are ignored.
src/OpenApiWeaver/OpenApiWeaverSourceGenerator.cs Implements metadata-based filtering so only explicitly marked OpenAPI documents are processed.
src/OpenApiWeaver/buildTransitive/OpenApiWeaver.targets Adds OpenApiWeaverItemKind=Document metadata and makes it compiler-visible.
samples/SampleApp/SampleApp.csproj Switches sample from AdditionalFiles to OpenApiWeaverDocument and imports props/targets for local (project reference) usage.
README.md Removes/updates documentation implying AdditionalFiles direct support.
docs/getting-started.md Removes AdditionalFiles alternative path and updates “How it works” wording.
docs/configuration.md Removes AdditionalFiles section and updates wording to match the new explicit configuration requirement.

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

@shibayan shibayan merged commit faecbbc into master Mar 31, 2026
8 checks passed
@shibayan shibayan deleted the msbuild-prop branch March 31, 2026 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants