-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Support new HTTP result types in OpenAPI schema generation #64562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
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.
There was a problem hiding this 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
OpenApiSchemaServiceto recognize and handle the new file result types as binary string schemas - Added test data entries for the new types in
JsonTypeInfoExtensionsTeststo verify proper schema reference ID generation - Created comprehensive test cases in
OpenApiSchemaServiceTeststo 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 |
Added support for
FileStreamResult,FileContentHttpResult, andFileStreamHttpResultinOpenApiSchemaService. These types are now represented as binary string schemas in OpenAPI documentation.Updated
JsonTypeInfoExtensionsTeststo include test cases for the new types, ensuring proper handling and naming in the schema.Added new test cases in
OpenApiSchemaServiceTeststo 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