Skip to content

Conversation

@marcominerva
Copy link
Contributor

Added support for FileStreamResult, FileContentHttpResult, and FileStreamHttpResult in OpenApiSchemaService. These types are now represented as binary string schemas in OpenAPI documentation.

Updated JsonTypeInfoExtensionsTests to include test cases for the new types, ensuring proper handling and naming in the schema.

Added new test cases in OpenApiSchemaServiceTests to verify OpenAPI response handling for the new HTTP result types, validating schema generation with appropriate content types.

These changes improve compatibility with new ASP.NET Core features and enhance the accuracy of API documentation.

Fixes #64561

Added support for `FileStreamResult`, `FileContentHttpResult`,
and `FileStreamHttpResult` in `OpenApiSchemaService`. These
types are now represented as binary string schemas in OpenAPI
documentation.

Updated `JsonTypeInfoExtensionsTests` to include test cases
for the new types, ensuring proper handling and naming in the
schema.

Added new test cases in `OpenApiSchemaServiceTests` to verify
OpenAPI response handling for the new HTTP result types,
validating schema generation with appropriate content types.

These changes improve compatibility with new ASP.NET Core
features and enhance the accuracy of API documentation.
Copilot AI review requested due to automatic review settings November 28, 2025 16:06
@marcominerva marcominerva requested review from a team and captainsafia as code owners November 28, 2025 16:06
@github-actions github-actions bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Nov 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Nov 28, 2025
Copilot finished reviewing on behalf of marcominerva November 28, 2025 16:10
Copy link
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

This PR adds support for three new HTTP file result types (FileStreamResult, FileContentHttpResult, and FileStreamHttpResult) to the OpenAPI schema generation service. These types join the existing FileContentResult in being represented as binary string schemas in OpenAPI documentation, improving compatibility with recent ASP.NET Core features.

Key Changes

  • Extended OpenApiSchemaService to recognize and handle the new file result types as binary string schemas
  • Added test data entries for the new types in JsonTypeInfoExtensionsTests to verify proper schema reference ID generation
  • Created comprehensive test cases in OpenApiSchemaServiceTests to validate OpenAPI response handling for each new type

Reviewed changes

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

File Description
src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs Added FileStreamResult, FileContentHttpResult, and FileStreamHttpResult to the schema transformation logic, treating them as binary string types
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Extensions/JsonTypeInfoExtensionsTests.cs Added test data entries for the three new file result types to verify schema reference ID generation
src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiSchemaService/OpenApiSchemaService.ResponseSchemas.cs Added three new test methods to validate OpenAPI response schema generation for the new file result types with appropriate content types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates community-contribution Indicates that the PR has been added by a community member feature-openapi

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect mapping of FileContentHttpResult and FileContentHttpResult in OpenAPI

2 participants