OpenAPI Controllers Sample with XML Comments #36770
Open
+617
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a comprehensive sample demonstrating XML documentation with OpenAPI in .NET 10, updates package versions, and improves the repository's .gitignore configuration for JetBrains Rider IDE support.
Changes Made
1. Add OpenAPI XML Controllers Sample
Added a new complete sample project under
aspnetcore/fundamentals/openapi/samples/10.x/aspnet-openapi-xml-controllers/that demonstrates:.httpfilesKey Features:
AdditionalFiles.xmldemonstrates adding external XML docs to OpenAPIApi-remove.csprojexample showing how to disable the compile-time OpenAPI source generator analyzerNew Files:
aspnet-openapi-xml-controllers/api/Api.csproj- Main API project fileaspnet-openapi-xml-controllers/api/Api.http- 73 lines of example HTTP requestsaspnet-openapi-xml-controllers/api/Controllers/ProjectBoardsController.cs- 119 linesaspnet-openapi-xml-controllers/api/Controllers/TodosController.cs- 161 linesaspnet-openapi-xml-controllers/api/Program.cs- Application startup configurationaspnet-openapi-xml-controllers/api/Properties/launchSettings.json- Launch profiles with Development environmentaspnet-openapi-xml-controllers/api/appsettings.json&appsettings.Development.json- Configuration filesaspnet-openapi-xml-controllers/api/AdditionalFiles.xml- External XML documentation exampleaspnet-openapi-xml-controllers/api/Api-remove.csproj.xml- Analyzer disable exampleaspnet-openapi-xml-controllers/models/Models.csproj- Shared models projectaspnet-openapi-xml-controllers/models/ProjectBoard.cs- 32 linesaspnet-openapi-xml-controllers/models/Todo.cs- 47 linesaspnet-openapi-xml-controllers/models/TodoPriority.cs- 27 linesaspnet-openapi-xml-controllers/global.json- SDK version specificationaspnet-openapi-xml/api/Properties/launchSettings.json- Launch profiles with Development environment2. Bump OpenAPI Package Version
Updated
Microsoft.AspNetCore.OpenApipackage from preview version to stable 10.0.3 in the existing XML sample (aspnet-openapi-xml/api/Api.csproj).Added
#pragma warning disable ASPDEPR002/#pragma warning restore ASPDEPR002inaspnet-openapi-xml/api/ProjectBoardApis.csto suppress deprecation warnings and maintain clean builds.Modified Files:
samples/10.x/aspnet-openapi-xml/api/Api.csproj- Package version updatesamples/10.x/aspnet-openapi-xml/api/ProjectBoardApis.cs- Added pragma directivesProperties/launchSettings.jsonwith ASPNETCORE_ENVIRONMENT set to Development3. Improve .gitignore for Rider IDE
Added
.idea/directory to.gitignoreto exclude JetBrains Rider project files from version control, improving the development experience for contributors using Rider IDE.Modified Files:
.gitignore- Added Rider-specific ignore patternTesting
.httpfile validatedAdditional Notes